Skip to content

Commit af147b7

Browse files
damien-lemoalaxboe
authored andcommitted
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: 6f8fd75 ("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>
1 parent 7b29518 commit af147b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk-flush.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ 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;
133+
if (rq->bio)
134+
rq->__sector = rq->bio->bi_iter.bi_sector;
134135

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

0 commit comments

Comments
 (0)