[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241125-work-cred-v2-10-68b9d38bb5b2@kernel.org>
Date: Mon, 25 Nov 2024 15:10:06 +0100
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Amir Goldstein <amir73il@...il.com>, Miklos Szeredi <miklos@...redi.hu>,
Al Viro <viro@...iv.linux.org.uk>, Jens Axboe <axboe@...nel.dk>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>
Subject: [PATCH v2 10/29] aio: avoid pointless cred reference count bump
iocb->fsync.creds already holds a reference count that is stable while
the operation is performed.
Signed-off-by: Christian Brauner <brauner@...nel.org>
---
fs/aio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/aio.c b/fs/aio.c
index 5e57dcaed7f1ae1e4b38009b51a665954b31f5bd..50671640b5883f5d20f652e23c4ea3fe04c989f2 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1639,10 +1639,10 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
static void aio_fsync_work(struct work_struct *work)
{
struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work);
- const struct cred *old_cred = override_creds(get_new_cred(iocb->fsync.creds));
+ const struct cred *old_cred = override_creds(iocb->fsync.creds);
iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
- put_cred(revert_creds(old_cred));
+ revert_creds(old_cred);
put_cred(iocb->fsync.creds);
iocb_put(iocb);
}
--
2.45.2
Powered by blists - more mailing lists