From: Jens Axboe <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>
Subject: [PATCH 3/4] io_uring: add ->needs_fs to the opcode requirements table
Date: Fri, 7 Feb 2020 08:50:38 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Set it for openat/openat2/statx, as they all potentially need relative
path lookups if AT_FDCWD is used.
Signed-off-by: Jens Axboe <[email protected]>
---
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
next prev parent reply other threads:[~2020-02-07 15:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 15:50 [PATCHSET 0/4] Allow relative lookups Jens Axboe
2020-02-07 15:50 ` [PATCH 1/4] io_uring: grab owning task fs_struct Jens Axboe
2020-02-07 15:50 ` [PATCH 2/4] io-wq: add support for inheriting ->fs Jens Axboe
2020-02-07 15:50 ` Jens Axboe [this message]
2020-02-07 15:50 ` [PATCH 4/4] io_uring: allow AT_FDCWD for non-file openat/openat2/statx Jens Axboe
2020-02-07 21:56 ` [PATCHSET 0/4] Allow relative lookups Stefan Metzmacher
2020-02-07 22:47 ` Jens Axboe
2020-02-07 22:56 ` Stefan Metzmacher
2020-02-07 23:07 ` Stefan Metzmacher
2020-02-08 20:05 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox