Commit 5d63944f authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4: Ensure the delegation cred is pinned when we call delegreturn

Ensure we don't release the delegation cred during the call to
nfs4_proc_delegreturn().

Fixes: ee05f456 ("NFSv4: Fix races between open and delegreturn")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 8c75593c
...@@ -255,13 +255,18 @@ void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred, ...@@ -255,13 +255,18 @@ void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred,
static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *delegation, int issync) static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *delegation, int issync)
{ {
const struct cred *cred;
int res = 0; int res = 0;
if (!test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) if (!test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) {
res = nfs4_proc_delegreturn(inode, spin_lock(&delegation->lock);
delegation->cred, cred = get_cred(delegation->cred);
spin_unlock(&delegation->lock);
res = nfs4_proc_delegreturn(inode, cred,
&delegation->stateid, &delegation->stateid,
issync); issync);
put_cred(cred);
}
return res; return res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment