summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:41 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:41 -0500
commit6dc9d57af9917f5c7faa13c17b770dce17c3972b (patch)
tree8d51f023311912eca8b0d9ccd448a0b7176bccba /fs/nfs/nfs4state.c
parent028600143079c8e8f8366bbc2eb29977743baf3a (diff)
downloadkernel-crypto-6dc9d57af9917f5c7faa13c17b770dce17c3972b.tar.gz
kernel-crypto-6dc9d57af9917f5c7faa13c17b770dce17c3972b.tar.xz
kernel-crypto-6dc9d57af9917f5c7faa13c17b770dce17c3972b.zip
NFSv4: Callers to nfs4_get_renew_cred() need to hold nfs_client->cl_lock
Ditto for nfs4_get_setclientid_cred(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 99182b3229e..300faba9a18 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -71,14 +71,12 @@ static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred)
return status;
}
-static struct rpc_cred *nfs4_get_machine_cred(struct nfs_client *clp)
+static struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp)
{
struct rpc_cred *cred = NULL;
- spin_lock(&clp->cl_lock);
if (clp->cl_machine_cred != NULL)
cred = get_rpccred(clp->cl_machine_cred);
- spin_unlock(&clp->cl_lock);
return cred;
}
@@ -94,7 +92,7 @@ static void nfs4_clear_machine_cred(struct nfs_client *clp)
put_rpccred(cred);
}
-struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
+struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
{
struct nfs4_state_owner *sp;
struct rb_node *pos;
@@ -110,13 +108,24 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
return cred;
}
+static struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
+{
+ struct rpc_cred *cred;
+
+ spin_lock(&clp->cl_lock);
+ cred = nfs4_get_renew_cred_locked(clp);
+ spin_unlock(&clp->cl_lock);
+ return cred;
+}
+
static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
{
struct nfs4_state_owner *sp;
struct rb_node *pos;
struct rpc_cred *cred;
- cred = nfs4_get_machine_cred(clp);
+ spin_lock(&clp->cl_lock);
+ cred = nfs4_get_machine_cred_locked(clp);
if (cred != NULL)
goto out;
pos = rb_first(&clp->cl_state_owners);
@@ -125,6 +134,7 @@ static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
cred = get_rpccred(sp->so_cred);
}
out:
+ spin_unlock(&clp->cl_lock);
return cred;
}