Patch "block: don't allow splitting of a REQ_NOWAIT bio" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    block: don't allow splitting of a REQ_NOWAIT bio

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     block-don-t-allow-splitting-of-a-req_nowait-bio.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 9cea62b2cbabff8ed46f2df17778b624ad9dd25a Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@xxxxxxxxx>
Date: Wed, 4 Jan 2023 08:52:06 -0700
Subject: block: don't allow splitting of a REQ_NOWAIT bio

From: Jens Axboe <axboe@xxxxxxxxx>

commit 9cea62b2cbabff8ed46f2df17778b624ad9dd25a upstream.

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: stable@xxxxxxxxxxxxxxx # 5.15+
Link: https://github.com/axboe/liburing/issues/766
Reported-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
Reviewed-by: Keith Busch <kbusch@xxxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 block/blk-merge.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -300,6 +300,16 @@ static struct bio *bio_split_rw(struct b
 	*segs = nsegs;
 	return NULL;
 split:
+	/*
+	 * We can't sanely support splitting for a REQ_NOWAIT bio. End it
+	 * with EAGAIN if splitting is required and return an error pointer.
+	 */
+	if (bio->bi_opf & REQ_NOWAIT) {
+		bio->bi_status = BLK_STS_AGAIN;
+		bio_endio(bio);
+		return ERR_PTR(-EAGAIN);
+	}
+
 	*segs = nsegs;
 
 	/*


Patches currently in stable-queue which might be from axboe@xxxxxxxxx are

queue-6.1/io_uring-cancel-re-grab-ctx-mutex-after-finishing-wa.patch
queue-6.1/io_uring-check-for-valid-register-opcode-earlier.patch
queue-6.1/arm-renumber-bits-related-to-_tif_work_mask.patch
queue-6.1/io_uring-pin-context-while-queueing-deferred-tw.patch
queue-6.1/ublk-honor-io_uring_f_nonblock-for-handling-control-.patch
queue-6.1/io_uring-fix-cq-waiting-timeout-handling.patch
queue-6.1/block-don-t-allow-splitting-of-a-req_nowait-bio.patch
queue-6.1/io_uring-io-wq-free-worker-if-task_work-creation-is-canceled.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux