summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorStefan Roesch <shr@fb.com>2022-09-12 09:53:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-23 14:14:04 +0200
commit248c48ced209468f7a9fc71098c3482ba66fe7bb (patch)
tree60373d71ce56b1987bf99e02bce642cc3588b3d3 /block
parentd31efde8d45d4ae5a014f088bab1ef68745c069e (diff)
downloadlinux-stable-248c48ced209468f7a9fc71098c3482ba66fe7bb.tar.gz
linux-stable-248c48ced209468f7a9fc71098c3482ba66fe7bb.tar.bz2
linux-stable-248c48ced209468f7a9fc71098c3482ba66fe7bb.zip
block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for nowait
[ Upstream commit 56f99b8d06ef1ed1c9730948f9f05ac2b930a20b ] Today blk_queue_enter() and __bio_queue_enter() return -EBUSY for the nowait code path. This is not correct: they should return -EAGAIN instead. This problem was detected by fio. The following command exposed the above problem: t/io_uring -p0 -d128 -b4096 -s32 -c32 -F1 -B0 -R0 -X1 -n24 -P1 -u1 -O0 /dev/ng0n1 By applying the patch, the retry case is handled correctly in the slow path. Signed-off-by: Stefan Roesch <shr@fb.com> Fixes: bfd343aa1718 ("blk-mq: don't wait in blk_mq_queue_enter() if __GFP_WAIT isn't set") Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 27fb1357ad4b..cc6fbcb6d252 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -338,7 +338,7 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
while (!blk_try_enter_queue(q, pm)) {
if (flags & BLK_MQ_REQ_NOWAIT)
- return -EBUSY;
+ return -EAGAIN;
/*
* read pair of barrier in blk_freeze_queue_start(), we need to
@@ -368,7 +368,7 @@ int __bio_queue_enter(struct request_queue *q, struct bio *bio)
if (test_bit(GD_DEAD, &disk->state))
goto dead;
bio_wouldblock_error(bio);
- return -EBUSY;
+ return -EAGAIN;
}
/*