Commit af147b74 authored by Damien Le Moal's avatar Damien Le Moal Committed by Jens Axboe

block: Fix flush request sector restore

Make sure that a request bio is not NULL before trying to restore the
request start sector.
Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
Fixes: 6f8fd758 ("block: Restore sector of flush requests")
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240501110907.96950-9-dlemoal@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7b295187
...@@ -130,7 +130,8 @@ static void blk_flush_restore_request(struct request *rq) ...@@ -130,7 +130,8 @@ static void blk_flush_restore_request(struct request *rq)
* original @rq->bio. Restore it. * original @rq->bio. Restore it.
*/ */
rq->bio = rq->biotail; rq->bio = rq->biotail;
rq->__sector = rq->bio->bi_iter.bi_sector; if (rq->bio)
rq->__sector = rq->bio->bi_iter.bi_sector;
/* make @rq a normal request */ /* make @rq a normal request */
rq->rq_flags &= ~RQF_FLUSH_SEQ; rq->rq_flags &= ~RQF_FLUSH_SEQ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment