提交 a819ecc1 编写于 作者: J Jeff Layton 提交者: J. Bruce Fields

nfsd: add locking to stateowner release

Once we remove the client_mutex, we'll need to properly protect
the stateowner reference counts using the cl_lock.
Signed-off-by: NJeff Layton <jlayton@primarydata.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 882e9d25
......@@ -937,9 +937,14 @@ release_all_access(struct nfs4_ol_stateid *stp)
static void nfs4_put_stateowner(struct nfs4_stateowner *sop)
{
if (!atomic_dec_and_test(&sop->so_count))
struct nfs4_client *clp = sop->so_client;
might_lock(&clp->cl_lock);
if (!atomic_dec_and_lock(&sop->so_count, &clp->cl_lock))
return;
sop->so_ops->so_unhash(sop);
spin_unlock(&clp->cl_lock);
kfree(sop->so_owner.data);
sop->so_ops->so_free(sop);
}
......@@ -3078,11 +3083,7 @@ static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, u
static void nfs4_unhash_openowner(struct nfs4_stateowner *so)
{
struct nfs4_client *clp = so->so_client;
spin_lock(&clp->cl_lock);
unhash_openowner_locked(openowner(so));
spin_unlock(&clp->cl_lock);
}
static void nfs4_free_openowner(struct nfs4_stateowner *so)
......@@ -4842,11 +4843,7 @@ find_lockowner_str(clientid_t *clid, struct xdr_netobj *owner,
static void nfs4_unhash_lockowner(struct nfs4_stateowner *sop)
{
struct nfs4_client *clp = sop->so_client;
spin_lock(&clp->cl_lock);
unhash_lockowner_locked(lockowner(sop));
spin_unlock(&clp->cl_lock);
}
static void nfs4_free_lockowner(struct nfs4_stateowner *sop)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册