@@ -436,6 +436,7 @@ static void unhash_stid(struct nfs4_stid *s)
{
list_add(&dp->dl_perfile, &fp->fi_delegations);
list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations);
+ dp->dl_stid.sc_type = NFS4_DELEG_STID;
}
/* Called under the state lock. */
@@ -446,8 +447,9 @@ static void unhash_stid(struct nfs4_stid *s)
list_del_init(&dp->dl_perclnt);
list_del_init(&dp->dl_perfile);
list_del_init(&dp->dl_recall_lru);
- spin_unlock(&recall_lock);
+ dp->dl_stid.sc_type = 0;
nfs4_put_deleg_lease(dp->dl_file);
+ spin_unlock(&recall_lock);
put_nfs4_file(dp->dl_file);
dp->dl_file = NULL;
}
@@ -3078,7 +3080,6 @@ static int nfs4_set_delegation(struct nfs4_delegation *dp, struct nfs4_file *fp)
atomic_inc(&fp->fi_delegees);
hash_delegation_locked(dp, fp);
spin_unlock(&recall_lock);
- dp->dl_stid.sc_type = NFS4_DELEG_STID;
return 0;
out_free:
put_nfs4_file(fp);
make sure all atomic ops are under the recall_lock Signed-off-by: Benny Halevy <bhalevy@primarydata.com> --- fs/nfsd/nfs4state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)