From 1efbc3bdba598078e21a1e9ab74c069d55ed3a2d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 9 Dec 2019 20:12:38 -0700 Subject: [PATCH] io_uring: only hash regular files for async work execution to #26323578 commit 53108d476a105ab2597d7a4e6040b127829391b5 upstream. 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 Signed-off-by: Joseph Qi Acked-by: Xiaoguang Wang --- fs/io_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 6160913f085a..28371e53d117 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -580,7 +580,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: -- GitLab