block: make sure FSEQ_DATA request has the same rq_disk as the original
authorTejun Heo <tj@kernel.org>
Fri, 3 Sep 2010 09:56:17 +0000 (11:56 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 10 Sep 2010 10:35:37 +0000 (12:35 +0200)
rq->rq_disk and bio->bi_bdev->bd_disk may differ if a request has
passed through remapping drivers.  FSEQ_DATA request incorrectly
followed bio->bi_bdev->bd_disk ending up being issued w/ mismatching
rq_disk.  Make it follow orig_rq->rq_disk.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Tested-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
block/blk-flush.c

index cb4c8440a1fc7479bf162d878a1c97553fd8efb5..7d1fc982e78f081393a06b37703d72f81b093d82 100644 (file)
@@ -111,6 +111,13 @@ static struct request *queue_next_fseq(struct request_queue *q)
                break;
        case QUEUE_FSEQ_DATA:
                init_request_from_bio(rq, orig_rq->bio);
+               /*
+                * orig_rq->rq_disk may be different from
+                * bio->bi_bdev->bd_disk if orig_rq got here through
+                * remapping drivers.  Make sure rq->rq_disk points
+                * to the same one as orig_rq.
+                */
+               rq->rq_disk = orig_rq->rq_disk;
                rq->cmd_flags &= ~(REQ_FLUSH | REQ_FUA);
                rq->cmd_flags |= orig_rq->cmd_flags & (REQ_FLUSH | REQ_FUA);
                rq->end_io = flush_data_end_io;