diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2024-05-01 20:09:01 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-05-01 08:08:43 -0600 |
commit | af147b740f111730c2e387ee6c0ac3ada7d51117 (patch) | |
tree | de842594a9a1c4bfc784869129faa2371421b961 /block | |
parent | 7b295187287e0006dd1b0b95f995f00878e436c5 (diff) | |
download | lwn-af147b740f111730c2e387ee6c0ac3ada7d51117.tar.gz lwn-af147b740f111730c2e387ee6c0ac3ada7d51117.zip |
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: Yi Zhang <yi.zhang@redhat.com>
Fixes: 6f8fd758de63 ("block: Restore sector of flush requests")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240501110907.96950-9-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-flush.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index 2f58ae018464..c17cf8ed8113 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -130,7 +130,8 @@ 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; + if (rq->bio) + rq->__sector = rq->bio->bi_iter.bi_sector; /* make @rq a normal request */ rq->rq_flags &= ~RQF_FLUSH_SEQ; |