aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-08-22 10:55:47 -0400
committerJeff Layton <jlayton@primarydata.com>2014-10-07 14:06:12 -0400
commit1c7dd2ff430fa14b45c9def54468e3a25ab8342b (patch)
treea80695c6ca57be5da96c63b67d1264507bfe509e /fs/nfsd/nfs4state.c
parente6f5c78930e409f3a6b37f5484313a416359ac7f (diff)
locks: define a lm_setup handler for leases
...and move the fasync setup into it for fcntl lease calls. At the same time, change the semantics of how the file_lock double-pointer is handled. Up until now, on a successful lease return you got a pointer to the lock on the list. This is bad, since that pointer can no longer be relied on as valid once the inode->i_lock has been released. Change the code to instead just zero out the pointer if the lease we passed in ended up being used. Then the callers can just check to see if it's NULL after the call and free it if it isn't. The priv argument has the same semantics. The lm_setup function can zero the pointer out to signal to the caller that it should not be freed after the function returns. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7c803db2a027..5349528136e2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3793,12 +3793,10 @@ static int nfs4_setlease(struct nfs4_delegation *dp)
3793 fl->fl_file = filp; 3793 fl->fl_file = filp;
3794 ret = fl; 3794 ret = fl;
3795 status = vfs_setlease(filp, fl->fl_type, &fl, NULL); 3795 status = vfs_setlease(filp, fl->fl_type, &fl, NULL);
3796 if (status) { 3796 if (fl)
3797 locks_free_lock(fl); 3797 locks_free_lock(fl);
3798 if (status)
3798 goto out_fput; 3799 goto out_fput;
3799 }
3800 if (ret != fl)
3801 locks_free_lock(fl);
3802 spin_lock(&state_lock); 3800 spin_lock(&state_lock);
3803 spin_lock(&fp->fi_lock); 3801 spin_lock(&fp->fi_lock);
3804 /* Did the lease get broken before we took the lock? */ 3802 /* Did the lease get broken before we took the lock? */