diff mbox series

[15/26] nfs/nfs4recover: avoid pointless cred reference count bump

Message ID 20241124-work-cred-v1-15-f352241c3970@kernel.org
State Superseded
Headers show
Series cred: rework {override,revert}_creds() | expand

Commit Message

Christian Brauner Nov. 24, 2024, 1:44 p.m. UTC
No need for the extra reference count bump.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/nfsd/nfs4recover.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Chuck Lever Nov. 25, 2024, 1:10 p.m. UTC | #1
On Sun, Nov 24, 2024 at 02:44:01PM +0100, Christian Brauner wrote:
> No need for the extra reference count bump.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>
> ---
>  fs/nfsd/nfs4recover.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> index 2834091cc988b1403aa2908f69e336f2fe4e0922..5b1d36b26f93450bb14d1d922feeeb6c35399fd5 100644
> --- a/fs/nfsd/nfs4recover.c
> +++ b/fs/nfsd/nfs4recover.c
> @@ -81,8 +81,7 @@ nfs4_save_creds(const struct cred **original_creds)
>  
>  	new->fsuid = GLOBAL_ROOT_UID;
>  	new->fsgid = GLOBAL_ROOT_GID;
> -	*original_creds = override_creds(get_new_cred(new));
> -	put_cred(new);
> +	*original_creds = override_creds(new);
>  	return 0;
>  }
>  
> 
> -- 
> 2.45.2
> 
> 

Acked-by: Chuck Lever <chuck.lever@oracle.com>
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 2834091cc988b1403aa2908f69e336f2fe4e0922..5b1d36b26f93450bb14d1d922feeeb6c35399fd5 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -81,8 +81,7 @@  nfs4_save_creds(const struct cred **original_creds)
 
 	new->fsuid = GLOBAL_ROOT_UID;
 	new->fsgid = GLOBAL_ROOT_GID;
-	*original_creds = override_creds(get_new_cred(new));
-	put_cred(new);
+	*original_creds = override_creds(new);
 	return 0;
 }