Commit 68b18f52 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd: make nfs4_get_existing_delegation less confusing

This doesn't "get" anything.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
parent 0c911f54
...@@ -900,20 +900,16 @@ void nfs4_unhash_stid(struct nfs4_stid *s) ...@@ -900,20 +900,16 @@ void nfs4_unhash_stid(struct nfs4_stid *s)
} }
/** /**
* nfs4_get_existing_delegation - Discover if this delegation already exists * nfs4_delegation_exists - Discover if this delegation already exists
* @clp: a pointer to the nfs4_client we're granting a delegation to * @clp: a pointer to the nfs4_client we're granting a delegation to
* @fp: a pointer to the nfs4_file we're granting a delegation on * @fp: a pointer to the nfs4_file we're granting a delegation on
* *
* Return: * Return:
* On success: NULL if an existing delegation was not found. * On success: true iff an existing delegation is found
*
* On error: -EAGAIN if one was previously granted to this nfs4_client
* for this nfs4_file.
*
*/ */
static int static bool
nfs4_get_existing_delegation(struct nfs4_client *clp, struct nfs4_file *fp) nfs4_delegation_exists(struct nfs4_client *clp, struct nfs4_file *fp)
{ {
struct nfs4_delegation *searchdp = NULL; struct nfs4_delegation *searchdp = NULL;
struct nfs4_client *searchclp = NULL; struct nfs4_client *searchclp = NULL;
...@@ -946,15 +942,13 @@ nfs4_get_existing_delegation(struct nfs4_client *clp, struct nfs4_file *fp) ...@@ -946,15 +942,13 @@ nfs4_get_existing_delegation(struct nfs4_client *clp, struct nfs4_file *fp)
static int static int
hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp)
{ {
int status;
struct nfs4_client *clp = dp->dl_stid.sc_client; struct nfs4_client *clp = dp->dl_stid.sc_client;
lockdep_assert_held(&state_lock); lockdep_assert_held(&state_lock);
lockdep_assert_held(&fp->fi_lock); lockdep_assert_held(&fp->fi_lock);
status = nfs4_get_existing_delegation(clp, fp); if (nfs4_delegation_exists(clp, fp))
if (status) return -EAGAIN;
return status;
++fp->fi_delegees; ++fp->fi_delegees;
refcount_inc(&dp->dl_stid.sc_count); refcount_inc(&dp->dl_stid.sc_count);
dp->dl_stid.sc_type = NFS4_DELEG_STID; dp->dl_stid.sc_type = NFS4_DELEG_STID;
...@@ -4391,7 +4385,7 @@ static struct nfs4_delegation * ...@@ -4391,7 +4385,7 @@ static struct nfs4_delegation *
nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate) struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate)
{ {
int status; int status = 0;
struct nfs4_delegation *dp; struct nfs4_delegation *dp;
if (fp->fi_had_conflict) if (fp->fi_had_conflict)
...@@ -4399,7 +4393,8 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, ...@@ -4399,7 +4393,8 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
spin_lock(&state_lock); spin_lock(&state_lock);
spin_lock(&fp->fi_lock); spin_lock(&fp->fi_lock);
status = nfs4_get_existing_delegation(clp, fp); if (nfs4_delegation_exists(clp, fp))
status = -EAGAIN;
spin_unlock(&fp->fi_lock); spin_unlock(&fp->fi_lock);
spin_unlock(&state_lock); spin_unlock(&state_lock);
......
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