Skip to content

Commit

Permalink
block: make sure FSEQ_DATA request has the same rq_disk as the original
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Kiyoshi Ueda <[email protected]>
Tested-by: Kiyoshi Ueda <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and Jens Axboe committed Sep 10, 2010
1 parent 47f70d5 commit 09d60c7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions block/blk-flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 09d60c7

Please sign in to comment.