Skip to content

Commit 6f8fd75

Browse files
damien-lemoalaxboe
authored andcommitted
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>
1 parent de4c7be commit 6f8fd75

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-flush.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static void blk_flush_restore_request(struct request *rq)
130130
* original @rq->bio. Restore it.
131131
*/
132132
rq->bio = rq->biotail;
133+
rq->__sector = rq->bio->bi_iter.bi_sector;
133134

134135
/* make @rq a normal request */
135136
rq->rq_flags &= ~RQF_FLUSH_SEQ;

0 commit comments

Comments
 (0)