diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2024-04-08 10:41:01 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-04-17 08:44:02 -0600 |
commit | 6f8fd758de63bab513c551bb1796a14f8cdc40d9 (patch) | |
tree | fab7e17b2991c262d6f126a936789dea09c461fd /block/blk-flush.c | |
parent | de4c7bef9d330e4a59c78181bd596c7569d7208e (diff) | |
download | lwn-6f8fd758de63bab513c551bb1796a14f8cdc40d9.tar.gz lwn-6f8fd758de63bab513c551bb1796a14f8cdc40d9.zip |
block: Restore sector of flush requests
On completion of a flush sequence, blk_flush_restore_request() restores
the bio of a request to the original submitted BIO. However, the last
use of the request in the flush sequence may have been for a POSTFLUSH
which does not have a sector. So make sure to restore the request sector
using the iter sector of the original BIO. This BIO has not changed yet
since the completions of the flush sequence intermediate steps use
requeueing of the request until all steps are completed.
Restoring the request sector ensures that blk_mq_end_request() will see
a valid sector as originally set when the flush BIO was submitted.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240408014128.205141-2-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r-- | block/blk-flush.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index b0f314f4bc14..2f58ae018464 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -130,6 +130,7 @@ static void blk_flush_restore_request(struct request *rq) * original @rq->bio. Restore it. */ rq->bio = rq->biotail; + rq->__sector = rq->bio->bi_iter.bi_sector; /* make @rq a normal request */ rq->rq_flags &= ~RQF_FLUSH_SEQ; |