aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4state.c251
2 files changed, 181 insertions, 72 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 18d64cb5985b..7a7474073148 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -110,7 +110,7 @@ struct nfs_unique_id {
110struct nfs4_state_owner { 110struct nfs4_state_owner {
111 struct nfs_unique_id so_owner_id; 111 struct nfs_unique_id so_owner_id;
112 struct nfs_server *so_server; 112 struct nfs_server *so_server;
113 struct rb_node so_client_node; 113 struct rb_node so_server_node;
114 114
115 struct rpc_cred *so_cred; /* Associated cred */ 115 struct rpc_cred *so_cred; /* Associated cred */
116 116
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 286084f148e3..2336d532cf66 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -105,14 +105,17 @@ static void nfs4_clear_machine_cred(struct nfs_client *clp)
105 put_rpccred(cred); 105 put_rpccred(cred);
106} 106}
107 107
108struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp) 108static struct rpc_cred *
109nfs4_get_renew_cred_server_locked(struct nfs_server *server)
109{ 110{
111 struct rpc_cred *cred = NULL;
110 struct nfs4_state_owner *sp; 112 struct nfs4_state_owner *sp;
111 struct rb_node *pos; 113 struct rb_node *pos;
112 struct rpc_cred *cred = NULL;
113 114
114 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 115 for (pos = rb_first(&server->state_owners);
115 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 116 pos != NULL;
117 pos = rb_next(pos)) {
118 sp = rb_entry(pos, struct nfs4_state_owner, so_server_node);
116 if (list_empty(&sp->so_states)) 119 if (list_empty(&sp->so_states))
117 continue; 120 continue;
118 cred = get_rpccred(sp->so_cred); 121 cred = get_rpccred(sp->so_cred);
@@ -121,6 +124,28 @@ struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
121 return cred; 124 return cred;
122} 125}
123 126
127/**
128 * nfs4_get_renew_cred_locked - Acquire credential for a renew operation
129 * @clp: client state handle
130 *
131 * Returns an rpc_cred with reference count bumped, or NULL.
132 * Caller must hold clp->cl_lock.
133 */
134struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
135{
136 struct rpc_cred *cred = NULL;
137 struct nfs_server *server;
138
139 rcu_read_lock();
140 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
141 cred = nfs4_get_renew_cred_server_locked(server);
142 if (cred != NULL)
143 break;
144 }
145 rcu_read_unlock();
146 return cred;
147}
148
124#if defined(CONFIG_NFS_V4_1) 149#if defined(CONFIG_NFS_V4_1)
125 150
126static int nfs41_setup_state_renewal(struct nfs_client *clp) 151static int nfs41_setup_state_renewal(struct nfs_client *clp)
@@ -231,28 +256,56 @@ struct rpc_cred *nfs4_get_exchange_id_cred(struct nfs_client *clp)
231 256
232#endif /* CONFIG_NFS_V4_1 */ 257#endif /* CONFIG_NFS_V4_1 */
233 258
234struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) 259static struct rpc_cred *
260nfs4_get_setclientid_cred_server(struct nfs_server *server)
235{ 261{
262 struct nfs_client *clp = server->nfs_client;
263 struct rpc_cred *cred = NULL;
236 struct nfs4_state_owner *sp; 264 struct nfs4_state_owner *sp;
237 struct rb_node *pos; 265 struct rb_node *pos;
266
267 spin_lock(&clp->cl_lock);
268 pos = rb_first(&server->state_owners);
269 if (pos != NULL) {
270 sp = rb_entry(pos, struct nfs4_state_owner, so_server_node);
271 cred = get_rpccred(sp->so_cred);
272 }
273 spin_unlock(&clp->cl_lock);
274 return cred;
275}
276
277/**
278 * nfs4_get_setclientid_cred - Acquire credential for a setclientid operation
279 * @clp: client state handle
280 *
281 * Returns an rpc_cred with reference count bumped, or NULL.
282 */
283struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
284{
285 struct nfs_server *server;
238 struct rpc_cred *cred; 286 struct rpc_cred *cred;
239 287
240 spin_lock(&clp->cl_lock); 288 spin_lock(&clp->cl_lock);
241 cred = nfs4_get_machine_cred_locked(clp); 289 cred = nfs4_get_machine_cred_locked(clp);
290 spin_unlock(&clp->cl_lock);
242 if (cred != NULL) 291 if (cred != NULL)
243 goto out; 292 goto out;
244 pos = rb_first(&clp->cl_state_owners); 293
245 if (pos != NULL) { 294 rcu_read_lock();
246 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 295 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
247 cred = get_rpccred(sp->so_cred); 296 cred = nfs4_get_setclientid_cred_server(server);
297 if (cred != NULL)
298 break;
248 } 299 }
300 rcu_read_unlock();
301
249out: 302out:
250 spin_unlock(&clp->cl_lock);
251 return cred; 303 return cred;
252} 304}
253 305
254static void nfs_alloc_unique_id(struct rb_root *root, struct nfs_unique_id *new, 306static void nfs_alloc_unique_id_locked(struct rb_root *root,
255 __u64 minval, int maxbits) 307 struct nfs_unique_id *new,
308 __u64 minval, int maxbits)
256{ 309{
257 struct rb_node **p, *parent; 310 struct rb_node **p, *parent;
258 struct nfs_unique_id *pos; 311 struct nfs_unique_id *pos;
@@ -307,16 +360,15 @@ static void nfs_free_unique_id(struct rb_root *root, struct nfs_unique_id *id)
307} 360}
308 361
309static struct nfs4_state_owner * 362static struct nfs4_state_owner *
310nfs4_find_state_owner(struct nfs_server *server, struct rpc_cred *cred) 363nfs4_find_state_owner_locked(struct nfs_server *server, struct rpc_cred *cred)
311{ 364{
312 struct nfs_client *clp = server->nfs_client; 365 struct rb_node **p = &server->state_owners.rb_node,
313 struct rb_node **p = &clp->cl_state_owners.rb_node,
314 *parent = NULL; 366 *parent = NULL;
315 struct nfs4_state_owner *sp, *res = NULL; 367 struct nfs4_state_owner *sp, *res = NULL;
316 368
317 while (*p != NULL) { 369 while (*p != NULL) {
318 parent = *p; 370 parent = *p;
319 sp = rb_entry(parent, struct nfs4_state_owner, so_client_node); 371 sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);
320 372
321 if (server < sp->so_server) { 373 if (server < sp->so_server) {
322 p = &parent->rb_left; 374 p = &parent->rb_left;
@@ -340,24 +392,17 @@ nfs4_find_state_owner(struct nfs_server *server, struct rpc_cred *cred)
340} 392}
341 393
342static struct nfs4_state_owner * 394static struct nfs4_state_owner *
343nfs4_insert_state_owner(struct nfs_client *clp, struct nfs4_state_owner *new) 395nfs4_insert_state_owner_locked(struct nfs4_state_owner *new)
344{ 396{
345 struct rb_node **p = &clp->cl_state_owners.rb_node, 397 struct nfs_server *server = new->so_server;
398 struct rb_node **p = &server->state_owners.rb_node,
346 *parent = NULL; 399 *parent = NULL;
347 struct nfs4_state_owner *sp; 400 struct nfs4_state_owner *sp;
348 401
349 while (*p != NULL) { 402 while (*p != NULL) {
350 parent = *p; 403 parent = *p;
351 sp = rb_entry(parent, struct nfs4_state_owner, so_client_node); 404 sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);
352 405
353 if (new->so_server < sp->so_server) {
354 p = &parent->rb_left;
355 continue;
356 }
357 if (new->so_server > sp->so_server) {
358 p = &parent->rb_right;
359 continue;
360 }
361 if (new->so_cred < sp->so_cred) 406 if (new->so_cred < sp->so_cred)
362 p = &parent->rb_left; 407 p = &parent->rb_left;
363 else if (new->so_cred > sp->so_cred) 408 else if (new->so_cred > sp->so_cred)
@@ -367,18 +412,21 @@ nfs4_insert_state_owner(struct nfs_client *clp, struct nfs4_state_owner *new)
367 return sp; 412 return sp;
368 } 413 }
369 } 414 }
370 nfs_alloc_unique_id(&clp->cl_openowner_id, &new->so_owner_id, 1, 64); 415 nfs_alloc_unique_id_locked(&server->openowner_id,
371 rb_link_node(&new->so_client_node, parent, p); 416 &new->so_owner_id, 1, 64);
372 rb_insert_color(&new->so_client_node, &clp->cl_state_owners); 417 rb_link_node(&new->so_server_node, parent, p);
418 rb_insert_color(&new->so_server_node, &server->state_owners);
373 return new; 419 return new;
374} 420}
375 421
376static void 422static void
377nfs4_remove_state_owner(struct nfs_client *clp, struct nfs4_state_owner *sp) 423nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp)
378{ 424{
379 if (!RB_EMPTY_NODE(&sp->so_client_node)) 425 struct nfs_server *server = sp->so_server;
380 rb_erase(&sp->so_client_node, &clp->cl_state_owners); 426
381 nfs_free_unique_id(&clp->cl_openowner_id, &sp->so_owner_id); 427 if (!RB_EMPTY_NODE(&sp->so_server_node))
428 rb_erase(&sp->so_server_node, &server->state_owners);
429 nfs_free_unique_id(&server->openowner_id, &sp->so_owner_id);
382} 430}
383 431
384/* 432/*
@@ -407,23 +455,32 @@ nfs4_alloc_state_owner(void)
407static void 455static void
408nfs4_drop_state_owner(struct nfs4_state_owner *sp) 456nfs4_drop_state_owner(struct nfs4_state_owner *sp)
409{ 457{
410 if (!RB_EMPTY_NODE(&sp->so_client_node)) { 458 if (!RB_EMPTY_NODE(&sp->so_server_node)) {
411 struct nfs_client *clp = sp->so_server->nfs_client; 459 struct nfs_server *server = sp->so_server;
460 struct nfs_client *clp = server->nfs_client;
412 461
413 spin_lock(&clp->cl_lock); 462 spin_lock(&clp->cl_lock);
414 rb_erase(&sp->so_client_node, &clp->cl_state_owners); 463 rb_erase(&sp->so_server_node, &server->state_owners);
415 RB_CLEAR_NODE(&sp->so_client_node); 464 RB_CLEAR_NODE(&sp->so_server_node);
416 spin_unlock(&clp->cl_lock); 465 spin_unlock(&clp->cl_lock);
417 } 466 }
418} 467}
419 468
420struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred) 469/**
470 * nfs4_get_state_owner - Look up a state owner given a credential
471 * @server: nfs_server to search
472 * @cred: RPC credential to match
473 *
474 * Returns a pointer to an instantiated nfs4_state_owner struct, or NULL.
475 */
476struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
477 struct rpc_cred *cred)
421{ 478{
422 struct nfs_client *clp = server->nfs_client; 479 struct nfs_client *clp = server->nfs_client;
423 struct nfs4_state_owner *sp, *new; 480 struct nfs4_state_owner *sp, *new;
424 481
425 spin_lock(&clp->cl_lock); 482 spin_lock(&clp->cl_lock);
426 sp = nfs4_find_state_owner(server, cred); 483 sp = nfs4_find_state_owner_locked(server, cred);
427 spin_unlock(&clp->cl_lock); 484 spin_unlock(&clp->cl_lock);
428 if (sp != NULL) 485 if (sp != NULL)
429 return sp; 486 return sp;
@@ -433,7 +490,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
433 new->so_server = server; 490 new->so_server = server;
434 new->so_cred = cred; 491 new->so_cred = cred;
435 spin_lock(&clp->cl_lock); 492 spin_lock(&clp->cl_lock);
436 sp = nfs4_insert_state_owner(clp, new); 493 sp = nfs4_insert_state_owner_locked(new);
437 spin_unlock(&clp->cl_lock); 494 spin_unlock(&clp->cl_lock);
438 if (sp == new) 495 if (sp == new)
439 get_rpccred(cred); 496 get_rpccred(cred);
@@ -444,6 +501,11 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
444 return sp; 501 return sp;
445} 502}
446 503
504/**
505 * nfs4_put_state_owner - Release a nfs4_state_owner
506 * @sp: state owner data to release
507 *
508 */
447void nfs4_put_state_owner(struct nfs4_state_owner *sp) 509void nfs4_put_state_owner(struct nfs4_state_owner *sp)
448{ 510{
449 struct nfs_client *clp = sp->so_server->nfs_client; 511 struct nfs_client *clp = sp->so_server->nfs_client;
@@ -451,7 +513,7 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp)
451 513
452 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) 514 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
453 return; 515 return;
454 nfs4_remove_state_owner(clp, sp); 516 nfs4_remove_state_owner_locked(sp);
455 spin_unlock(&clp->cl_lock); 517 spin_unlock(&clp->cl_lock);
456 rpc_destroy_wait_queue(&sp->so_sequence.wait); 518 rpc_destroy_wait_queue(&sp->so_sequence.wait);
457 put_rpccred(cred); 519 put_rpccred(cred);
@@ -657,7 +719,8 @@ __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner, pid_t fl_p
657static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, fl_owner_t fl_owner, pid_t fl_pid, unsigned int type) 719static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, fl_owner_t fl_owner, pid_t fl_pid, unsigned int type)
658{ 720{
659 struct nfs4_lock_state *lsp; 721 struct nfs4_lock_state *lsp;
660 struct nfs_client *clp = state->owner->so_server->nfs_client; 722 struct nfs_server *server = state->owner->so_server;
723 struct nfs_client *clp = server->nfs_client;
661 724
662 lsp = kzalloc(sizeof(*lsp), GFP_NOFS); 725 lsp = kzalloc(sizeof(*lsp), GFP_NOFS);
663 if (lsp == NULL) 726 if (lsp == NULL)
@@ -681,7 +744,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
681 return NULL; 744 return NULL;
682 } 745 }
683 spin_lock(&clp->cl_lock); 746 spin_lock(&clp->cl_lock);
684 nfs_alloc_unique_id(&clp->cl_lockowner_id, &lsp->ls_id, 1, 64); 747 nfs_alloc_unique_id_locked(&server->lockowner_id, &lsp->ls_id, 1, 64);
685 spin_unlock(&clp->cl_lock); 748 spin_unlock(&clp->cl_lock);
686 INIT_LIST_HEAD(&lsp->ls_locks); 749 INIT_LIST_HEAD(&lsp->ls_locks);
687 return lsp; 750 return lsp;
@@ -689,10 +752,11 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
689 752
690static void nfs4_free_lock_state(struct nfs4_lock_state *lsp) 753static void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
691{ 754{
692 struct nfs_client *clp = lsp->ls_state->owner->so_server->nfs_client; 755 struct nfs_server *server = lsp->ls_state->owner->so_server;
756 struct nfs_client *clp = server->nfs_client;
693 757
694 spin_lock(&clp->cl_lock); 758 spin_lock(&clp->cl_lock);
695 nfs_free_unique_id(&clp->cl_lockowner_id, &lsp->ls_id); 759 nfs_free_unique_id(&server->lockowner_id, &lsp->ls_id);
696 spin_unlock(&clp->cl_lock); 760 spin_unlock(&clp->cl_lock);
697 rpc_destroy_wait_queue(&lsp->ls_sequence.wait); 761 rpc_destroy_wait_queue(&lsp->ls_sequence.wait);
698 kfree(lsp); 762 kfree(lsp);
@@ -1138,15 +1202,19 @@ static void nfs4_clear_open_state(struct nfs4_state *state)
1138 } 1202 }
1139} 1203}
1140 1204
1141static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp, int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state)) 1205static void nfs4_reset_seqids(struct nfs_server *server,
1206 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1142{ 1207{
1208 struct nfs_client *clp = server->nfs_client;
1143 struct nfs4_state_owner *sp; 1209 struct nfs4_state_owner *sp;
1144 struct rb_node *pos; 1210 struct rb_node *pos;
1145 struct nfs4_state *state; 1211 struct nfs4_state *state;
1146 1212
1147 /* Reset all sequence ids to zero */ 1213 spin_lock(&clp->cl_lock);
1148 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 1214 for (pos = rb_first(&server->state_owners);
1149 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 1215 pos != NULL;
1216 pos = rb_next(pos)) {
1217 sp = rb_entry(pos, struct nfs4_state_owner, so_server_node);
1150 sp->so_seqid.flags = 0; 1218 sp->so_seqid.flags = 0;
1151 spin_lock(&sp->so_lock); 1219 spin_lock(&sp->so_lock);
1152 list_for_each_entry(state, &sp->so_states, open_states) { 1220 list_for_each_entry(state, &sp->so_states, open_states) {
@@ -1155,6 +1223,18 @@ static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp, int (*mark_re
1155 } 1223 }
1156 spin_unlock(&sp->so_lock); 1224 spin_unlock(&sp->so_lock);
1157 } 1225 }
1226 spin_unlock(&clp->cl_lock);
1227}
1228
1229static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp,
1230 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1231{
1232 struct nfs_server *server;
1233
1234 rcu_read_lock();
1235 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1236 nfs4_reset_seqids(server, mark_reclaim);
1237 rcu_read_unlock();
1158} 1238}
1159 1239
1160static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) 1240static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
@@ -1172,25 +1252,41 @@ static void nfs4_reclaim_complete(struct nfs_client *clp,
1172 (void)ops->reclaim_complete(clp); 1252 (void)ops->reclaim_complete(clp);
1173} 1253}
1174 1254
1175static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) 1255static void nfs4_clear_reclaim_server(struct nfs_server *server)
1176{ 1256{
1257 struct nfs_client *clp = server->nfs_client;
1177 struct nfs4_state_owner *sp; 1258 struct nfs4_state_owner *sp;
1178 struct rb_node *pos; 1259 struct rb_node *pos;
1179 struct nfs4_state *state; 1260 struct nfs4_state *state;
1180 1261
1181 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) 1262 spin_lock(&clp->cl_lock);
1182 return 0; 1263 for (pos = rb_first(&server->state_owners);
1183 1264 pos != NULL;
1184 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 1265 pos = rb_next(pos)) {
1185 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 1266 sp = rb_entry(pos, struct nfs4_state_owner, so_server_node);
1186 spin_lock(&sp->so_lock); 1267 spin_lock(&sp->so_lock);
1187 list_for_each_entry(state, &sp->so_states, open_states) { 1268 list_for_each_entry(state, &sp->so_states, open_states) {
1188 if (!test_and_clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags)) 1269 if (!test_and_clear_bit(NFS_STATE_RECLAIM_REBOOT,
1270 &state->flags))
1189 continue; 1271 continue;
1190 nfs4_state_mark_reclaim_nograce(clp, state); 1272 nfs4_state_mark_reclaim_nograce(clp, state);
1191 } 1273 }
1192 spin_unlock(&sp->so_lock); 1274 spin_unlock(&sp->so_lock);
1193 } 1275 }
1276 spin_unlock(&clp->cl_lock);
1277}
1278
1279static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp)
1280{
1281 struct nfs_server *server;
1282
1283 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
1284 return 0;
1285
1286 rcu_read_lock();
1287 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1288 nfs4_clear_reclaim_server(server);
1289 rcu_read_unlock();
1194 1290
1195 nfs_delegation_reap_unclaimed(clp); 1291 nfs_delegation_reap_unclaimed(clp);
1196 return 1; 1292 return 1;
@@ -1262,27 +1358,40 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
1262 1358
1263static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) 1359static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
1264{ 1360{
1361 struct nfs4_state_owner *sp;
1362 struct nfs_server *server;
1265 struct rb_node *pos; 1363 struct rb_node *pos;
1266 int status = 0; 1364 int status = 0;
1267 1365
1268restart: 1366restart:
1269 spin_lock(&clp->cl_lock); 1367 rcu_read_lock();
1270 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 1368 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
1271 struct nfs4_state_owner *sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 1369 spin_lock(&clp->cl_lock);
1272 if (!test_and_clear_bit(ops->owner_flag_bit, &sp->so_flags)) 1370 for (pos = rb_first(&server->state_owners);
1273 continue; 1371 pos != NULL;
1274 atomic_inc(&sp->so_count); 1372 pos = rb_next(pos)) {
1275 spin_unlock(&clp->cl_lock); 1373 sp = rb_entry(pos,
1276 status = nfs4_reclaim_open_state(sp, ops); 1374 struct nfs4_state_owner, so_server_node);
1277 if (status < 0) { 1375 if (!test_and_clear_bit(ops->owner_flag_bit,
1278 set_bit(ops->owner_flag_bit, &sp->so_flags); 1376 &sp->so_flags))
1377 continue;
1378 atomic_inc(&sp->so_count);
1379 spin_unlock(&clp->cl_lock);
1380 rcu_read_unlock();
1381
1382 status = nfs4_reclaim_open_state(sp, ops);
1383 if (status < 0) {
1384 set_bit(ops->owner_flag_bit, &sp->so_flags);
1385 nfs4_put_state_owner(sp);
1386 return nfs4_recovery_handle_error(clp, status);
1387 }
1388
1279 nfs4_put_state_owner(sp); 1389 nfs4_put_state_owner(sp);
1280 return nfs4_recovery_handle_error(clp, status); 1390 goto restart;
1281 } 1391 }
1282 nfs4_put_state_owner(sp); 1392 spin_unlock(&clp->cl_lock);
1283 goto restart;
1284 } 1393 }
1285 spin_unlock(&clp->cl_lock); 1394 rcu_read_unlock();
1286 return status; 1395 return status;
1287} 1396}
1288 1397