[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241125-work-cred-v2-13-68b9d38bb5b2@kernel.org>
Date: Mon, 25 Nov 2024 15:10:09 +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 13/29] nfs/localio: avoid pointless cred reference count
bumps
filp->f_cred already holds a reference count that is stable during the
operation.
Signed-off-by: Christian Brauner <brauner@...nel.org>
---
fs/nfs/localio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index cb0ba4a810324cc9a4913767ce5a9b4f52c416ac..8f0ce82a677e1589092a30240d6e60a289d64a58 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -371,7 +371,7 @@ static void nfs_local_call_read(struct work_struct *work)
struct iov_iter iter;
ssize_t status;
- save_cred = override_creds(get_new_cred(filp->f_cred));
+ save_cred = override_creds(filp->f_cred);
nfs_local_iter_init(&iter, iocb, READ);
@@ -381,7 +381,7 @@ static void nfs_local_call_read(struct work_struct *work)
nfs_local_read_done(iocb, status);
nfs_local_pgio_release(iocb);
- put_cred(revert_creds(save_cred));
+ revert_creds(save_cred);
}
static int
@@ -541,7 +541,7 @@ static void nfs_local_call_write(struct work_struct *work)
ssize_t status;
current->flags |= PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO;
- save_cred = override_creds(get_new_cred(filp->f_cred));
+ save_cred = override_creds(filp->f_cred);
nfs_local_iter_init(&iter, iocb, WRITE);
@@ -554,7 +554,7 @@ static void nfs_local_call_write(struct work_struct *work)
nfs_local_vfs_getattr(iocb);
nfs_local_pgio_release(iocb);
- put_cred(revert_creds(save_cred));
+ revert_creds(save_cred);
current->flags = old_flags;
}
--
2.45.2
Powered by blists - more mailing lists