aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-08-22 12:05:43 -0400
committerJeff Layton <jlayton@primarydata.com>2014-10-07 14:06:12 -0400
commit0c637be884f5eaa0ee53396ea7686ec0de03d126 (patch)
tree836e76037f50299616011f950d20bf5090cddabe /fs/nfsd
parente51673aa5d9a8c75cc836fac687fa4dde9a76182 (diff)
nfsd: don't keep a pointer to the lease in nfs4_file
Now that we don't need to pass in an actual lease pointer to vfs_setlease on unlock, we can stop tracking a pointer to the lease in the nfs4_file. Switch all of the places that check the fi_lease to check fi_deleg_file instead. We always set that at the same time so it will have the same semantics. Cc: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Jeff Layton <jlayton@primarydata.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c13
-rw-r--r--fs/nfsd/state.h1
2 files changed, 4 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 89d54e505155..188cd68aefb6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -679,14 +679,10 @@ nfs4_put_stid(struct nfs4_stid *s)
679static void nfs4_put_deleg_lease(struct nfs4_file *fp) 679static void nfs4_put_deleg_lease(struct nfs4_file *fp)
680{ 680{
681 struct file *filp = NULL; 681 struct file *filp = NULL;
682 struct file_lock *fl;
683 682
684 spin_lock(&fp->fi_lock); 683 spin_lock(&fp->fi_lock);
685 if (fp->fi_lease && atomic_dec_and_test(&fp->fi_delegees)) { 684 if (fp->fi_deleg_file && atomic_dec_and_test(&fp->fi_delegees))
686 swap(filp, fp->fi_deleg_file); 685 swap(filp, fp->fi_deleg_file);
687 fl = fp->fi_lease;
688 fp->fi_lease = NULL;
689 }
690 spin_unlock(&fp->fi_lock); 686 spin_unlock(&fp->fi_lock);
691 687
692 if (filp) { 688 if (filp) {
@@ -3068,8 +3064,8 @@ static void nfsd4_init_file(struct nfs4_file *fp, struct knfsd_fh *fh)
3068 INIT_LIST_HEAD(&fp->fi_stateids); 3064 INIT_LIST_HEAD(&fp->fi_stateids);
3069 INIT_LIST_HEAD(&fp->fi_delegations); 3065 INIT_LIST_HEAD(&fp->fi_delegations);
3070 fh_copy_shallow(&fp->fi_fhandle, fh); 3066 fh_copy_shallow(&fp->fi_fhandle, fh);
3067 fp->fi_deleg_file = NULL;
3071 fp->fi_had_conflict = false; 3068 fp->fi_had_conflict = false;
3072 fp->fi_lease = NULL;
3073 fp->fi_share_deny = 0; 3069 fp->fi_share_deny = 0;
3074 memset(fp->fi_fds, 0, sizeof(fp->fi_fds)); 3070 memset(fp->fi_fds, 0, sizeof(fp->fi_fds));
3075 memset(fp->fi_access, 0, sizeof(fp->fi_access)); 3071 memset(fp->fi_access, 0, sizeof(fp->fi_access));
@@ -3810,13 +3806,12 @@ static int nfs4_setlease(struct nfs4_delegation *dp)
3810 if (fp->fi_had_conflict) 3806 if (fp->fi_had_conflict)
3811 goto out_unlock; 3807 goto out_unlock;
3812 /* Race breaker */ 3808 /* Race breaker */
3813 if (fp->fi_lease) { 3809 if (fp->fi_deleg_file) {
3814 status = 0; 3810 status = 0;
3815 atomic_inc(&fp->fi_delegees); 3811 atomic_inc(&fp->fi_delegees);
3816 hash_delegation_locked(dp, fp); 3812 hash_delegation_locked(dp, fp);
3817 goto out_unlock; 3813 goto out_unlock;
3818 } 3814 }
3819 fp->fi_lease = fl;
3820 fp->fi_deleg_file = filp; 3815 fp->fi_deleg_file = filp;
3821 atomic_set(&fp->fi_delegees, 1); 3816 atomic_set(&fp->fi_delegees, 1);
3822 hash_delegation_locked(dp, fp); 3817 hash_delegation_locked(dp, fp);
@@ -3849,7 +3844,7 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
3849 spin_lock(&state_lock); 3844 spin_lock(&state_lock);
3850 spin_lock(&fp->fi_lock); 3845 spin_lock(&fp->fi_lock);
3851 dp->dl_stid.sc_file = fp; 3846 dp->dl_stid.sc_file = fp;
3852 if (!fp->fi_lease) { 3847 if (!fp->fi_deleg_file) {
3853 spin_unlock(&fp->fi_lock); 3848 spin_unlock(&fp->fi_lock);
3854 spin_unlock(&state_lock); 3849 spin_unlock(&state_lock);
3855 status = nfs4_setlease(dp); 3850 status = nfs4_setlease(dp);
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 4a89e00d7461..64f291a25a8c 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -477,7 +477,6 @@ struct nfs4_file {
477 atomic_t fi_access[2]; 477 atomic_t fi_access[2];
478 u32 fi_share_deny; 478 u32 fi_share_deny;
479 struct file *fi_deleg_file; 479 struct file *fi_deleg_file;
480 struct file_lock *fi_lease;
481 atomic_t fi_delegees; 480 atomic_t fi_delegees;
482 struct knfsd_fh fi_fhandle; 481 struct knfsd_fh fi_fhandle;
483 bool fi_had_conflict; 482 bool fi_had_conflict;