From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>,
[email protected], [email protected]
Subject: [PATCH] io-wq: use put instead of revert creds
Date: Wed, 29 Jan 2020 13:10:23 +0300 [thread overview]
Message-ID: <c79bab7a6bd174f32121c9508390264bff9950ca.1580292613.git.asml.silence@gmail.com> (raw)
There is no need to publish creds twice in io_wq_switch_creds() (in
revert_creds() and override_creds()). Just do override_creds() and
put_creds() if needed.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io-wq.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/io-wq.c b/fs/io-wq.c
index 8fbbadf04cc3..f7eb577ccd2d 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -425,11 +425,13 @@ static void io_wq_switch_mm(struct io_worker *worker, struct io_wq_work *work)
static void io_wq_switch_creds(struct io_worker *worker,
struct io_wq_work *work)
{
- if (worker->saved_creds)
- revert_creds(worker->saved_creds);
+ const struct cred *old_creds = override_creds(work->creds);
- worker->saved_creds = override_creds(work->creds);
worker->cur_creds = work->creds;
+ if (worker->saved_creds)
+ put_cred(old_creds); /* creds set by previous switch */
+ else
+ worker->saved_creds = old_creds;
}
static void io_worker_handle_work(struct io_worker *worker)
--
2.24.0
next reply other threads:[~2020-01-29 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 10:10 Pavel Begunkov [this message]
2020-01-29 13:39 ` [PATCH] io-wq: use put instead of revert creds 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=c79bab7a6bd174f32121c9508390264bff9950ca.1580292613.git.asml.silence@gmail.com \
[email protected] \
[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