[GIT PULL] One important block fix for 2.6.36-rc

From: Jens Axboe
Date: Sat Sep 25 2010 - 06:45:53 EST


Hi Linus,

Adrian Hunter just discovered that we may inadvertently merge writes
with discards, since discards are now of the same type as file system
requests. This is very problematic, as it may turn a write into a
discard or vice versa.

Please pull asap, thanks.

are available in the git repository at:
git://git.kernel.dk/linux-2.6-block.git for-linus

Adrian Hunter (1):
block: prevent merges of discard and write requests

block/blk-merge.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 3b0cd42..eafc94f 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -362,6 +362,18 @@ static int attempt_merge(struct request_queue *q, struct request *req,
return 0;

/*
+ * Don't merge file system requests and discard requests
+ */
+ if ((req->cmd_flags & REQ_DISCARD) != (next->cmd_flags & REQ_DISCARD))
+ return 0;
+
+ /*
+ * Don't merge discard requests and secure discard requests
+ */
+ if ((req->cmd_flags & REQ_SECURE) != (next->cmd_flags & REQ_SECURE))
+ return 0;
+
+ /*
* not contiguous
*/
if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/