aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2018-02-19 11:38:33 -0500
committerJ. Bruce Fields <bfields@redhat.com>2018-03-20 17:51:12 -0400
commit68b18f52947bbe77bc9ddb23626f30ed5cf70641 (patch)
tree330475071442a455da93bc30ce4e43cd76b13bb2
parent0c911f5408e49a313dd17f2f331c62c3db515f34 (diff)
nfsd: make nfs4_get_existing_delegation less confusing
This doesn't "get" anything. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org>
-rw-r--r--fs/nfsd/nfs4state.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9e9f32f03bf4..9ec485980bf0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -900,20 +900,16 @@ void nfs4_unhash_stid(struct nfs4_stid *s)
900} 900}
901 901
902/** 902/**
903 * nfs4_get_existing_delegation - Discover if this delegation already exists 903 * nfs4_delegation_exists - Discover if this delegation already exists
904 * @clp: a pointer to the nfs4_client we're granting a delegation to 904 * @clp: a pointer to the nfs4_client we're granting a delegation to
905 * @fp: a pointer to the nfs4_file we're granting a delegation on 905 * @fp: a pointer to the nfs4_file we're granting a delegation on
906 * 906 *
907 * Return: 907 * Return:
908 * On success: NULL if an existing delegation was not found. 908 * On success: true iff an existing delegation is found
909 *
910 * On error: -EAGAIN if one was previously granted to this nfs4_client
911 * for this nfs4_file.
912 *
913 */ 909 */
914 910
915static int 911static bool
916nfs4_get_existing_delegation(struct nfs4_client *clp, struct nfs4_file *fp) 912nfs4_delegation_exists(struct nfs4_client *clp, struct nfs4_file *fp)
917{ 913{
918 struct nfs4_delegation *searchdp = NULL; 914 struct nfs4_delegation *searchdp = NULL;
919 struct nfs4_client *searchclp = NULL; 915 struct nfs4_client *searchclp = NULL;
@@ -946,15 +942,13 @@ nfs4_get_existing_delegation(struct nfs4_client *clp, struct nfs4_file *fp)
946static int 942static int
947hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) 943hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp)
948{ 944{
949 int status;
950 struct nfs4_client *clp = dp->dl_stid.sc_client; 945 struct nfs4_client *clp = dp->dl_stid.sc_client;
951 946
952 lockdep_assert_held(&state_lock); 947 lockdep_assert_held(&state_lock);
953 lockdep_assert_held(&fp->fi_lock); 948 lockdep_assert_held(&fp->fi_lock);
954 949
955 status = nfs4_get_existing_delegation(clp, fp); 950 if (nfs4_delegation_exists(clp, fp))
956 if (status) 951 return -EAGAIN;
957 return status;
958 ++fp->fi_delegees; 952 ++fp->fi_delegees;
959 refcount_inc(&dp->dl_stid.sc_count); 953 refcount_inc(&dp->dl_stid.sc_count);
960 dp->dl_stid.sc_type = NFS4_DELEG_STID; 954 dp->dl_stid.sc_type = NFS4_DELEG_STID;
@@ -4391,7 +4385,7 @@ static struct nfs4_delegation *
4391nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, 4385nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
4392 struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate) 4386 struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate)
4393{ 4387{
4394 int status; 4388 int status = 0;
4395 struct nfs4_delegation *dp; 4389 struct nfs4_delegation *dp;
4396 4390
4397 if (fp->fi_had_conflict) 4391 if (fp->fi_had_conflict)
@@ -4399,7 +4393,8 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
4399 4393
4400 spin_lock(&state_lock); 4394 spin_lock(&state_lock);
4401 spin_lock(&fp->fi_lock); 4395 spin_lock(&fp->fi_lock);
4402 status = nfs4_get_existing_delegation(clp, fp); 4396 if (nfs4_delegation_exists(clp, fp))
4397 status = -EAGAIN;
4403 spin_unlock(&fp->fi_lock); 4398 spin_unlock(&fp->fi_lock);
4404 spin_unlock(&state_lock); 4399 spin_unlock(&state_lock);
4405 4400