aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-02 12:49:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:38 -0400
commit7af654f8d1b7460415af5d1d326233478dd0f563 (patch)
tree00ebad16a49f13aa99b518f2554de5dcbeafa79c /fs/nfs
parent27b3f949b769a208e2849d28e7ad64cadac5d0e3 (diff)
NFSv4: Don't reuse expired nfs4_state_owner structs
That just confuses certain NFSv4 servers. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/client.c10
-rw-r--r--fs/nfs/nfs4state.c28
2 files changed, 0 insertions, 38 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 71d4c4cdac52..6b424407d631 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -131,7 +131,6 @@ static struct nfs_client *nfs_alloc_client(const char *hostname,
131 init_rwsem(&clp->cl_sem); 131 init_rwsem(&clp->cl_sem);
132 INIT_LIST_HEAD(&clp->cl_delegations); 132 INIT_LIST_HEAD(&clp->cl_delegations);
133 INIT_LIST_HEAD(&clp->cl_state_owners); 133 INIT_LIST_HEAD(&clp->cl_state_owners);
134 INIT_LIST_HEAD(&clp->cl_unused);
135 spin_lock_init(&clp->cl_lock); 134 spin_lock_init(&clp->cl_lock);
136 INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); 135 INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
137 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); 136 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
@@ -155,15 +154,6 @@ static void nfs4_shutdown_client(struct nfs_client *clp)
155#ifdef CONFIG_NFS_V4 154#ifdef CONFIG_NFS_V4
156 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state)) 155 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
157 nfs4_kill_renewd(clp); 156 nfs4_kill_renewd(clp);
158 while (!list_empty(&clp->cl_unused)) {
159 struct nfs4_state_owner *sp;
160
161 sp = list_entry(clp->cl_unused.next,
162 struct nfs4_state_owner,
163 so_list);
164 list_del(&sp->so_list);
165 kfree(sp);
166 }
167 BUG_ON(!list_empty(&clp->cl_state_owners)); 157 BUG_ON(!list_empty(&clp->cl_state_owners));
168 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state)) 158 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
169 nfs_idmap_delete(clp); 159 nfs_idmap_delete(clp);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 0030248d63ec..2b00c45aebea 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -75,21 +75,6 @@ nfs4_alloc_lockowner_id(struct nfs_client *clp)
75 return clp->cl_lockowner_id ++; 75 return clp->cl_lockowner_id ++;
76} 76}
77 77
78static struct nfs4_state_owner *
79nfs4_client_grab_unused(struct nfs_client *clp, struct rpc_cred *cred)
80{
81 struct nfs4_state_owner *sp = NULL;
82
83 if (!list_empty(&clp->cl_unused)) {
84 sp = list_entry(clp->cl_unused.next, struct nfs4_state_owner, so_list);
85 atomic_inc(&sp->so_count);
86 sp->so_cred = get_rpccred(cred);
87 list_move(&sp->so_list, &clp->cl_state_owners);
88 clp->cl_nunused--;
89 }
90 return sp;
91}
92
93struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) 78struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
94{ 79{
95 struct nfs4_state_owner *sp; 80 struct nfs4_state_owner *sp;
@@ -178,8 +163,6 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
178 new = nfs4_alloc_state_owner(); 163 new = nfs4_alloc_state_owner();
179 spin_lock(&clp->cl_lock); 164 spin_lock(&clp->cl_lock);
180 sp = nfs4_find_state_owner(clp, cred); 165 sp = nfs4_find_state_owner(clp, cred);
181 if (sp == NULL)
182 sp = nfs4_client_grab_unused(clp, cred);
183 if (sp == NULL && new != NULL) { 166 if (sp == NULL && new != NULL) {
184 list_add(&new->so_list, &clp->cl_state_owners); 167 list_add(&new->so_list, &clp->cl_state_owners);
185 new->so_client = clp; 168 new->so_client = clp;
@@ -206,17 +189,6 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp)
206 189
207 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) 190 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
208 return; 191 return;
209 if (clp->cl_nunused >= OPENOWNER_POOL_SIZE)
210 goto out_free;
211 if (list_empty(&sp->so_list))
212 goto out_free;
213 list_move(&sp->so_list, &clp->cl_unused);
214 clp->cl_nunused++;
215 spin_unlock(&clp->cl_lock);
216 put_rpccred(cred);
217 cred = NULL;
218 return;
219out_free:
220 list_del(&sp->so_list); 192 list_del(&sp->so_list);
221 spin_unlock(&clp->cl_lock); 193 spin_unlock(&clp->cl_lock);
222 put_rpccred(cred); 194 put_rpccred(cred);