diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 15:21:41 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 15:21:41 -0500 |
commit | 6dc9d57af9917f5c7faa13c17b770dce17c3972b (patch) | |
tree | 8d51f023311912eca8b0d9ccd448a0b7176bccba /fs/nfs/nfs4state.c | |
parent | 028600143079c8e8f8366bbc2eb29977743baf3a (diff) |
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.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 99182b3229e7..300faba9a18a 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) | |||
71 | return status; | 71 | return status; |
72 | } | 72 | } |
73 | 73 | ||
74 | static struct rpc_cred *nfs4_get_machine_cred(struct nfs_client *clp) | 74 | static struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp) |
75 | { | 75 | { |
76 | struct rpc_cred *cred = NULL; | 76 | struct rpc_cred *cred = NULL; |
77 | 77 | ||
78 | spin_lock(&clp->cl_lock); | ||
79 | if (clp->cl_machine_cred != NULL) | 78 | if (clp->cl_machine_cred != NULL) |
80 | cred = get_rpccred(clp->cl_machine_cred); | 79 | cred = get_rpccred(clp->cl_machine_cred); |
81 | spin_unlock(&clp->cl_lock); | ||
82 | return cred; | 80 | return cred; |
83 | } | 81 | } |
84 | 82 | ||
@@ -94,7 +92,7 @@ static void nfs4_clear_machine_cred(struct nfs_client *clp) | |||
94 | put_rpccred(cred); | 92 | put_rpccred(cred); |
95 | } | 93 | } |
96 | 94 | ||
97 | struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) | 95 | struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp) |
98 | { | 96 | { |
99 | struct nfs4_state_owner *sp; | 97 | struct nfs4_state_owner *sp; |
100 | struct rb_node *pos; | 98 | struct rb_node *pos; |
@@ -110,13 +108,24 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) | |||
110 | return cred; | 108 | return cred; |
111 | } | 109 | } |
112 | 110 | ||
111 | static struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) | ||
112 | { | ||
113 | struct rpc_cred *cred; | ||
114 | |||
115 | spin_lock(&clp->cl_lock); | ||
116 | cred = nfs4_get_renew_cred_locked(clp); | ||
117 | spin_unlock(&clp->cl_lock); | ||
118 | return cred; | ||
119 | } | ||
120 | |||
113 | static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) | 121 | static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) |
114 | { | 122 | { |
115 | struct nfs4_state_owner *sp; | 123 | struct nfs4_state_owner *sp; |
116 | struct rb_node *pos; | 124 | struct rb_node *pos; |
117 | struct rpc_cred *cred; | 125 | struct rpc_cred *cred; |
118 | 126 | ||
119 | cred = nfs4_get_machine_cred(clp); | 127 | spin_lock(&clp->cl_lock); |
128 | cred = nfs4_get_machine_cred_locked(clp); | ||
120 | if (cred != NULL) | 129 | if (cred != NULL) |
121 | goto out; | 130 | goto out; |
122 | pos = rb_first(&clp->cl_state_owners); | 131 | pos = rb_first(&clp->cl_state_owners); |
@@ -125,6 +134,7 @@ static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) | |||
125 | cred = get_rpccred(sp->so_cred); | 134 | cred = get_rpccred(sp->so_cred); |
126 | } | 135 | } |
127 | out: | 136 | out: |
137 | spin_unlock(&clp->cl_lock); | ||
128 | return cred; | 138 | return cred; |
129 | } | 139 | } |
130 | 140 | ||