Commit afbda402 authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields

nfsd: call nfs4_put_deleg_lease outside of state_lock

Currently, we hold the state_lock when releasing the lease. That's
potentially problematic in the future if we allow for setlease methods
that can sleep. Move the nfs4_put_deleg_lease call out of the delegation
unhashing routine (which was always a bit goofy anyway), and into the
unlocked sections of the callers of unhash_delegation_locked.
Signed-off-by: default avatarJeff Layton <jlayton@primarydata.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 6bcc034e
...@@ -722,7 +722,6 @@ unhash_delegation_locked(struct nfs4_delegation *dp) ...@@ -722,7 +722,6 @@ unhash_delegation_locked(struct nfs4_delegation *dp)
list_del_init(&dp->dl_recall_lru); list_del_init(&dp->dl_recall_lru);
list_del_init(&dp->dl_perfile); list_del_init(&dp->dl_perfile);
spin_unlock(&fp->fi_lock); spin_unlock(&fp->fi_lock);
nfs4_put_deleg_lease(fp);
} }
static void destroy_delegation(struct nfs4_delegation *dp) static void destroy_delegation(struct nfs4_delegation *dp)
...@@ -730,6 +729,7 @@ static void destroy_delegation(struct nfs4_delegation *dp) ...@@ -730,6 +729,7 @@ static void destroy_delegation(struct nfs4_delegation *dp)
spin_lock(&state_lock); spin_lock(&state_lock);
unhash_delegation_locked(dp); unhash_delegation_locked(dp);
spin_unlock(&state_lock); spin_unlock(&state_lock);
nfs4_put_deleg_lease(dp->dl_stid.sc_file);
nfs4_put_stid(&dp->dl_stid); nfs4_put_stid(&dp->dl_stid);
} }
...@@ -739,6 +739,8 @@ static void revoke_delegation(struct nfs4_delegation *dp) ...@@ -739,6 +739,8 @@ static void revoke_delegation(struct nfs4_delegation *dp)
WARN_ON(!list_empty(&dp->dl_recall_lru)); WARN_ON(!list_empty(&dp->dl_recall_lru));
nfs4_put_deleg_lease(dp->dl_stid.sc_file);
if (clp->cl_minorversion == 0) if (clp->cl_minorversion == 0)
nfs4_put_stid(&dp->dl_stid); nfs4_put_stid(&dp->dl_stid);
else { else {
...@@ -1639,6 +1641,7 @@ __destroy_client(struct nfs4_client *clp) ...@@ -1639,6 +1641,7 @@ __destroy_client(struct nfs4_client *clp)
while (!list_empty(&reaplist)) { while (!list_empty(&reaplist)) {
dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru); dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
list_del_init(&dp->dl_recall_lru); list_del_init(&dp->dl_recall_lru);
nfs4_put_deleg_lease(dp->dl_stid.sc_file);
nfs4_put_stid(&dp->dl_stid); nfs4_put_stid(&dp->dl_stid);
} }
while (!list_empty(&clp->cl_revoked)) { while (!list_empty(&clp->cl_revoked)) {
...@@ -6406,6 +6409,7 @@ nfs4_state_shutdown_net(struct net *net) ...@@ -6406,6 +6409,7 @@ nfs4_state_shutdown_net(struct net *net)
list_for_each_safe(pos, next, &reaplist) { list_for_each_safe(pos, next, &reaplist) {
dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
list_del_init(&dp->dl_recall_lru); list_del_init(&dp->dl_recall_lru);
nfs4_put_deleg_lease(dp->dl_stid.sc_file);
nfs4_put_stid(&dp->dl_stid); nfs4_put_stid(&dp->dl_stid);
} }
......
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