Set it for openat/openat2/statx, as they all potentially need relative path lookups if AT_FDCWD is used. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- fs/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index da6a5998fa30..957de0f99bcd 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -616,6 +616,8 @@ struct io_op_def { unsigned not_supported : 1; /* needs file table */ unsigned file_table : 1; + /* needs ->fs assigned */ + unsigned needs_fs : 1; }; static const struct io_op_def io_op_defs[] = { @@ -694,6 +696,7 @@ static const struct io_op_def io_op_defs[] = { .needs_file = 1, .fd_non_neg = 1, .file_table = 1, + .needs_fs = 1, }, [IORING_OP_CLOSE] = { .needs_file = 1, @@ -707,6 +710,7 @@ static const struct io_op_def io_op_defs[] = { .needs_mm = 1, .needs_file = 1, .fd_non_neg = 1, + .needs_fs = 1, }, [IORING_OP_READ] = { .needs_mm = 1, @@ -738,6 +742,7 @@ static const struct io_op_def io_op_defs[] = { .needs_file = 1, .fd_non_neg = 1, .file_table = 1, + .needs_fs = 1, }, [IORING_OP_EPOLL_CTL] = { .unbound_nonreg_file = 1, @@ -911,6 +916,8 @@ static inline void io_req_work_grab_env(struct io_kiocb *req, } if (!req->work.creds) req->work.creds = get_current_cred(); + if (!req->work.fs && def->needs_fs) + req->work.fs = req->ctx->fs; } static inline void io_req_work_drop_env(struct io_kiocb *req) -- 2.25.0