io_uring: ensure REQ_F_ISREG is set async offload
authorJens Axboe <axboe@kernel.dk>
Thu, 21 Jul 2022 15:06:47 +0000 (09:06 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Jul 2022 15:10:13 +0000 (09:10 -0600)
commitc910349016b32287068687248ea72987a2b40064
treede1e56289a64fdd2a19419cd2b3eda955a9f642a
parent7f91d3066ae1b75eb96ed1eef2b5d7d648762da4
io_uring: ensure REQ_F_ISREG is set async offload

If we're offloading requests directly to io-wq because IOSQE_ASYNC was
set in the sqe, we can miss hashing writes appropriately because we
haven't set REQ_F_ISREG yet. This can cause a performance regression
with buffered writes, as io-wq then no longer correctly serializes writes
to that file.

Ensure that we set the flags in io_prep_async_work(), which will cause
the io-wq work item to be hashed appropriately.

Fixes: 584b0180f0f4 ("io_uring: move read/write file prep state into actual opcode handler")
Link: https://lore.kernel.org/io-uring/20220608080054.GB22428@xsang-OptiPlex-9020/
Reported-and-tested-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/io_uring.h
io_uring/rw.c