summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2018-02-15 15:50:49 -0500
committerJ. Bruce Fields <bfields@redhat.com>2018-03-20 17:51:11 -0400
commitcba7b3d15071fa0deb5b6e7a1c97c29d2904e6a3 (patch)
tree0aacafcabfdae5ea822e35a8bbd0b058684c5786 /fs
parentb8232d3315ec746e3b5d4c9252541567e57a509b (diff)
downloadlinux-0-day-cba7b3d15071fa0deb5b6e7a1c97c29d2904e6a3.tar.gz
linux-0-day-cba7b3d15071fa0deb5b6e7a1c97c29d2904e6a3.tar.xz
nfsd: simplify nfs4_put_deleg_lease calls
Every single caller gets the file out of the delegation, so let's do that once in nfs4_put_deleg_lease. Plus we'll need it there for other reasons. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9072d0f8340b5..39a4de64ce93a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -875,9 +875,10 @@ nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid)
spin_unlock(&stid->sc_lock);
}
-static void nfs4_put_deleg_lease(struct nfs4_file *fp)
+static void nfs4_put_deleg_lease(struct nfs4_delegation *dp)
{
struct file *filp = NULL;
+ struct nfs4_file *fp = dp->dl_stid.sc_file;
WARN_ON_ONCE(!fp->fi_delegees);
@@ -992,7 +993,7 @@ static void destroy_delegation(struct nfs4_delegation *dp)
spin_unlock(&state_lock);
if (unhashed) {
put_clnt_odstate(dp->dl_clnt_odstate);
- nfs4_put_deleg_lease(dp->dl_stid.sc_file);
+ nfs4_put_deleg_lease(dp);
nfs4_put_stid(&dp->dl_stid);
}
}
@@ -1004,7 +1005,7 @@ static void revoke_delegation(struct nfs4_delegation *dp)
WARN_ON(!list_empty(&dp->dl_recall_lru));
put_clnt_odstate(dp->dl_clnt_odstate);
- nfs4_put_deleg_lease(dp->dl_stid.sc_file);
+ nfs4_put_deleg_lease(dp);
if (clp->cl_minorversion == 0)
nfs4_put_stid(&dp->dl_stid);
@@ -1916,7 +1917,7 @@ __destroy_client(struct nfs4_client *clp)
dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
list_del_init(&dp->dl_recall_lru);
put_clnt_odstate(dp->dl_clnt_odstate);
- nfs4_put_deleg_lease(dp->dl_stid.sc_file);
+ nfs4_put_deleg_lease(dp);
nfs4_put_stid(&dp->dl_stid);
}
while (!list_empty(&clp->cl_revoked)) {
@@ -7287,7 +7288,7 @@ nfs4_state_shutdown_net(struct net *net)
dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
list_del_init(&dp->dl_recall_lru);
put_clnt_odstate(dp->dl_clnt_odstate);
- nfs4_put_deleg_lease(dp->dl_stid.sc_file);
+ nfs4_put_deleg_lease(dp);
nfs4_put_stid(&dp->dl_stid);
}