io_uring: don't recycle provided buffer if punted to async worker
authorJens Axboe <axboe@kernel.dk>
Tue, 22 Mar 2022 20:12:33 +0000 (14:12 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Mar 2022 12:26:06 +0000 (06:26 -0600)
commit4d55f238f8b89124f73e50abbd05e413def514fe
tree708d8aab0fded171847c4c9a15689e25d42ab145
parentd89a4fac0fbc6fe5fc24d1c9a889440dcf410368
io_uring: don't recycle provided buffer if punted to async worker

We only really need to recycle the buffer when going async for a file
type that has an indefinite reponse time (eg non-file/bdev). And for
files that to arm poll, the async worker will arm poll anyway and the
buffer will get recycled there.

In that latter case, we're not holding ctx->uring_lock. Ensure we take
the issue_flags into account and acquire it if we need to.

Fixes: b1c62645758e ("io_uring: recycle provided buffers if request goes async")
Reported-by: Stefan Roesch <shr@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c