public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 1/7] io_uring: flags-based creds init in queue
Date: Sun, 18 Oct 2020 10:17:37 +0100	[thread overview]
Message-ID: <f242de86cf8715cc187d8cdc8079f951ef123113.1603011899.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Use IO_WQ_WORK_CREDS to figure out if req has creds to be used.
Since recently it should rely only on flags, but not value of
work.creds.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5651b9d701e0..fd2fc72c312c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6184,7 +6184,8 @@ static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs)
 again:
 	linked_timeout = io_prep_linked_timeout(req);
 
-	if ((req->flags & REQ_F_WORK_INITIALIZED) && req->work.identity->creds &&
+	if ((req->flags & REQ_F_WORK_INITIALIZED) &&
+	    (req->work.flags & IO_WQ_WORK_CREDS) &&
 	    req->work.identity->creds != current_cred()) {
 		if (old_creds)
 			revert_creds(old_creds);
@@ -6192,7 +6193,6 @@ static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs)
 			old_creds = NULL; /* restored original creds */
 		else
 			old_creds = override_creds(req->work.identity->creds);
-		req->work.flags |= IO_WQ_WORK_CREDS;
 	}
 
 	ret = io_issue_sqe(req, true, cs);
-- 
2.24.0


  reply	other threads:[~2020-10-18  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18  9:17 [PATCH for-5.10 0/7] another pack of random cleanups Pavel Begunkov
2020-10-18  9:17 ` Pavel Begunkov [this message]
2020-10-18  9:17 ` [PATCH 2/7] io_uring: kill ref get/drop in personality init Pavel Begunkov
2020-10-18  9:17 ` [PATCH 3/7] io_uring: inline io_fail_links() Pavel Begunkov
2020-10-18  9:17 ` [PATCH 4/7] io_uring: make cached_cq_overflow non atomic_t Pavel Begunkov
2020-10-18  9:17 ` [PATCH 5/7] io_uring: remove extra ->file check in poll prep Pavel Begunkov
2020-10-18  9:17 ` [PATCH 6/7] io_uring: inline io_poll_task_handler() Pavel Begunkov
2020-10-18  9:17 ` [PATCH 7/7] io_uring: do poll's hash_node init in common code Pavel Begunkov
2020-10-20 14:10 ` [PATCH for-5.10 0/7] another pack of random cleanups 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 \
    --in-reply-to=f242de86cf8715cc187d8cdc8079f951ef123113.1603011899.git.asml.silence@gmail.com \
    [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