From db0a2e0099be3a1cff55879225881465f16c67d3 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 19 Feb 2008 11:36:55 +0100 Subject: block: clear drain buffer if draining for write command Clear drain buffer before chaining if the command in question is a write. Signed-off-by: Tejun Heo Signed-off-by: Jens Axboe --- block/blk-merge.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block') diff --git a/block/blk-merge.c b/block/blk-merge.c index bef1b4d0fc02..7506c4fe0264 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -221,6 +221,9 @@ new_segment: } /* segments in rq */ if (q->dma_drain_size && q->dma_drain_needed(rq)) { + if (rq->cmd_flags & REQ_RW) + memset(q->dma_drain_buffer, 0, q->dma_drain_size); + sg->page_link &= ~0x02; sg = sg_next(sg); sg_set_page(sg, virt_to_page(q->dma_drain_buffer), -- cgit v1.2.2