summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-12-09 20:12:38 -0700
committerJens Axboe <axboe@kernel.dk>2019-12-10 16:33:23 -0700
commit53108d476a105ab2597d7a4e6040b127829391b5 (patch)
tree75a7dc0bf78597a0f059ad69262d87765775b988
parent4a0a7a187453e65bdd24b9ede045b4c36b958868 (diff)
downloadlinux-53108d476a105ab2597d7a4e6040b127829391b5.tar.bz2
io_uring: only hash regular files for async work execution
We hash regular files to avoid having multiple threads hammer on the inode mutex, but it should not be needed on other types of files (like sockets). Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3dae005bfb56..e54bd469d53a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -581,7 +581,9 @@ static inline bool io_prep_async_work(struct io_kiocb *req,
switch (req->sqe->opcode) {
case IORING_OP_WRITEV:
case IORING_OP_WRITE_FIXED:
- do_hashed = true;
+ /* only regular files should be hashed for writes */
+ if (req->flags & REQ_F_ISREG)
+ do_hashed = true;
/* fall-through */
case IORING_OP_READV:
case IORING_OP_READ_FIXED: