1 From b89e8b74e83de2a47ba2a23a26130a42e37a7f18 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Thu, 4 Feb 2021 16:02:10 +0100
4 Subject: Revert "Revert "block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT""
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 This reverts commit bba91cdba612fbce4f8575c5d94d2b146fb83ea3 which is
9 commit b0beb28097fa04177b3769f4bb7a0d0d9c4ae76e upstream.
11 It breaks things in 5.4.y, so let's drop it.
13 Reported-by: Andres Freund <andres@anarazel.de>
14 Cc: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
15 CC: Jens Axboe <axboe@kernel.dk>
16 Cc: Sasha Levin <sashal@kernel.org>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 block/blk-core.c | 11 +++++++----
20 1 file changed, 7 insertions(+), 4 deletions(-)
22 --- a/block/blk-core.c
23 +++ b/block/blk-core.c
24 @@ -886,11 +886,14 @@ generic_make_request_checks(struct bio *
28 - * For a REQ_NOWAIT based request, return -EOPNOTSUPP
29 - * if queue is not a request based queue.
30 + * Non-mq queues do not honor REQ_NOWAIT, so complete a bio
31 + * with BLK_STS_AGAIN status in order to catch -EAGAIN and
32 + * to give a chance to the caller to repeat request gracefully.
34 - if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q))
36 + if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) {
37 + status = BLK_STS_AGAIN;
41 if (should_fail_bio(bio))