Browse Source

NFSv4: Fix a typo in nfs_inode_reclaim_delegation

We were intending to put the previous instance of delegation->cred
before setting a new one.

Thanks to David Howells for spotting this.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust 17 years ago
parent
commit
05c88babab
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fs/nfs/delegation.c

+ 3 - 1
fs/nfs/delegation.c

@@ -109,6 +109,7 @@ again:
 void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res)
 void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res)
 {
 {
 	struct nfs_delegation *delegation = NFS_I(inode)->delegation;
 	struct nfs_delegation *delegation = NFS_I(inode)->delegation;
+	struct rpc_cred *oldcred;
 
 
 	if (delegation == NULL)
 	if (delegation == NULL)
 		return;
 		return;
@@ -116,11 +117,12 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, st
 			sizeof(delegation->stateid.data));
 			sizeof(delegation->stateid.data));
 	delegation->type = res->delegation_type;
 	delegation->type = res->delegation_type;
 	delegation->maxsize = res->maxsize;
 	delegation->maxsize = res->maxsize;
-	put_rpccred(cred);
+	oldcred = delegation->cred;
 	delegation->cred = get_rpccred(cred);
 	delegation->cred = get_rpccred(cred);
 	delegation->flags &= ~NFS_DELEGATION_NEED_RECLAIM;
 	delegation->flags &= ~NFS_DELEGATION_NEED_RECLAIM;
 	NFS_I(inode)->delegation_state = delegation->type;
 	NFS_I(inode)->delegation_state = delegation->type;
 	smp_wmb();
 	smp_wmb();
+	put_rpccred(oldcred);
 }
 }
 
 
 /*
 /*