Skip to content

Commit

Permalink
block: Fix flush request sector restore
Browse files Browse the repository at this point in the history
Make sure that a request bio is not NULL before trying to restore the
request start sector.

Reported-by: Yi Zhang <[email protected]>
Fixes: 6f8fd75 ("block: Restore sector of flush requests")
Signed-off-by: Damien Le Moal <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
damien-lemoal authored and axboe committed May 1, 2024
1 parent 7b29518 commit af147b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/blk-flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit af147b7

Please sign in to comment.