Skip to content

Commit 9cea62b

Browse files
committed
block: don't allow splitting of a REQ_NOWAIT bio
If we split a bio marked with REQ_NOWAIT, then we can trigger spurious EAGAIN if constituent parts of that split bio end up failing request allocations. Parts will complete just fine, but just a single failure in one of the chained bios will yield an EAGAIN final result for the parent bio. Return EAGAIN early if we end up needing to split such a bio, which allows for saner recovery handling. Cc: [email protected] # 5.15+ Link: axboe/liburing#766 Reported-by: Michael Kelley <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 613b148 commit 9cea62b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

block/blk-merge.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,16 @@ static struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
309309
*segs = nsegs;
310310
return NULL;
311311
split:
312+
/*
313+
* We can't sanely support splitting for a REQ_NOWAIT bio. End it
314+
* with EAGAIN if splitting is required and return an error pointer.
315+
*/
316+
if (bio->bi_opf & REQ_NOWAIT) {
317+
bio->bi_status = BLK_STS_AGAIN;
318+
bio_endio(bio);
319+
return ERR_PTR(-EAGAIN);
320+
}
321+
312322
*segs = nsegs;
313323

314324
/*

0 commit comments

Comments
 (0)