Lines Matching refs:clp

70 static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp);
94 static int nfs4_setup_state_renewal(struct nfs_client *clp)
99 if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) {
100 nfs4_schedule_state_renewal(clp);
104 status = nfs4_proc_get_lease_time(clp, &fsinfo);
106 nfs4_set_lease_period(clp, fsinfo.lease_time * HZ);
107 nfs4_schedule_state_renewal(clp);
113 int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred)
116 .clientid = clp->cl_clientid,
117 .confirm = clp->cl_confirm,
121 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id);
123 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state))
126 if (clp->cl_addr.ss_family == AF_INET6)
129 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid);
132 clp->cl_clientid = clid.clientid;
133 clp->cl_confirm = clid.confirm;
134 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
136 status = nfs4_proc_setclientid_confirm(clp, &clid, cred);
139 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
140 nfs4_setup_state_renewal(clp);
148 * @clp: nfs_client under test
149 * @result: OUT: found nfs_client, or clp
158 int nfs40_discover_server_trunking(struct nfs_client *clp,
163 .clientid = clp->cl_clientid,
164 .confirm = clp->cl_confirm,
166 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id);
171 if (clp->cl_addr.ss_family == AF_INET6)
174 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid);
177 clp->cl_clientid = clid.clientid;
178 clp->cl_confirm = clid.confirm;
180 status = nfs40_walk_client_list(clp, result, cred);
187 if (clp->cl_state)
188 nfs4_schedule_state_manager(clp);
194 const struct cred *nfs4_get_machine_cred(struct nfs_client *clp)
199 static void nfs4_root_machine_cred(struct nfs_client *clp)
203 clp->cl_principal = NULL;
204 clp->cl_rpcclient->cl_principal = NULL;
228 * @clp: client state handle
231 * Caller must hold clp->cl_lock.
233 const struct cred *nfs4_get_renew_cred(struct nfs_client *clp)
239 cred = nfs4_get_machine_cred(clp);
243 spin_lock(&clp->cl_lock);
245 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
251 spin_unlock(&clp->cl_lock);
266 static void nfs4_end_drain_session(struct nfs_client *clp)
268 struct nfs4_session *ses = clp->cl_session;
270 if (clp->cl_slot_tbl) {
271 nfs4_end_drain_slot_table(clp->cl_slot_tbl);
294 static int nfs4_begin_drain_session(struct nfs_client *clp)
296 struct nfs4_session *ses = clp->cl_session;
299 if (clp->cl_slot_tbl)
300 return nfs4_drain_slot_tbl(clp->cl_slot_tbl);
312 static void nfs41_finish_session_reset(struct nfs_client *clp)
314 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
315 clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
317 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
318 nfs4_setup_state_renewal(clp);
321 int nfs41_init_clientid(struct nfs_client *clp, const struct cred *cred)
325 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state))
327 status = nfs4_proc_exchange_id(clp, cred);
330 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
332 status = nfs4_proc_create_session(clp, cred);
335 if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R))
336 nfs4_state_start_reclaim_reboot(clp);
337 nfs41_finish_session_reset(clp);
338 nfs_mark_client_ready(clp, NFS_CS_READY);
346 * @clp: nfs_client under test
347 * @result: OUT: found nfs_client, or clp
356 int nfs41_discover_server_trunking(struct nfs_client *clp,
362 status = nfs4_proc_exchange_id(clp, cred);
366 status = nfs41_walk_client_list(clp, result, cred);
369 if (clp != *result)
377 if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R) {
378 if (!test_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags))
379 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
381 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
383 nfs4_schedule_state_manager(clp);
384 status = nfs_wait_client_init_complete(clp);
386 nfs_put_client(clp);
394 * @clp: client state handle
398 const struct cred *nfs4_get_clid_cred(struct nfs_client *clp)
402 cred = nfs4_get_machine_cred(clp);
547 struct nfs_client *clp = server->nfs_client;
552 spin_lock(&clp->cl_lock);
554 time_min = (long)time_max - (long)clp->cl_lease_time;
562 spin_unlock(&clp->cl_lock);
582 struct nfs_client *clp = server->nfs_client;
585 spin_lock(&clp->cl_lock);
587 spin_unlock(&clp->cl_lock);
593 spin_lock(&clp->cl_lock);
595 spin_unlock(&clp->cl_lock);
618 struct nfs_client *clp = server->nfs_client;
620 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
625 spin_unlock(&clp->cl_lock);
641 struct nfs_client *clp = server->nfs_client;
644 spin_lock(&clp->cl_lock);
649 spin_unlock(&clp->cl_lock);
953 struct nfs_client *clp = server->nfs_client;
955 clp->cl_mvops->free_lock_state(server, lsp);
1199 static void nfs4_clear_state_manager_bit(struct nfs_client *clp)
1202 clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
1204 wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING);
1205 rpc_wake_up(&clp->cl_rpcwaitq);
1211 void nfs4_schedule_state_manager(struct nfs_client *clp)
1215 struct rpc_clnt *clnt = clp->cl_rpcclient;
1218 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
1222 &clp->cl_state);
1224 wake_up_var(&clp->cl_state);
1229 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1233 refcount_inc(&clp->cl_count);
1240 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR));
1242 task = kthread_run(nfs4_run_state_manager, clp, "%s", buf);
1246 if (!nfs_client_init_is_complete(clp))
1247 nfs_mark_client_ready(clp, PTR_ERR(task));
1249 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
1250 nfs4_clear_state_manager_bit(clp);
1251 nfs_put_client(clp);
1259 void nfs4_schedule_lease_recovery(struct nfs_client *clp)
1261 if (!clp)
1263 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1264 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
1266 clp->cl_hostname);
1267 nfs4_schedule_state_manager(clp);
1281 struct nfs_client *clp = server->nfs_client;
1285 clp->cl_hostname);
1296 clp->cl_hostname);
1300 set_bit(NFS4CLNT_MOVED, &clp->cl_state);
1302 nfs4_schedule_state_manager(clp);
1310 * @clp: server to check for moved leases
1313 void nfs4_schedule_lease_moved_recovery(struct nfs_client *clp)
1316 __func__, clp->cl_clientid, clp->cl_hostname);
1318 set_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state);
1319 nfs4_schedule_state_manager(clp);
1323 int nfs4_wait_clnt_recover(struct nfs_client *clp)
1329 refcount_inc(&clp->cl_count);
1330 res = wait_on_bit_action(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING,
1334 if (clp->cl_cons_state < 0)
1335 res = clp->cl_cons_state;
1337 nfs_put_client(clp);
1341 int nfs4_client_recover_expired_lease(struct nfs_client *clp)
1347 ret = nfs4_wait_clnt_recover(clp);
1350 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1351 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state))
1353 nfs4_schedule_state_manager(clp);
1361 * @clp: client to process
1367 static void nfs40_handle_cb_pathdown(struct nfs_client *clp)
1369 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1370 nfs_expire_all_delegations(clp);
1372 clp->cl_hostname);
1375 void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
1377 nfs40_handle_cb_pathdown(clp);
1378 nfs4_schedule_state_manager(clp);
1381 static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
1393 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1397 int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state)
1404 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
1410 struct nfs_client *clp = server->nfs_client;
1412 if (!nfs4_state_mark_reclaim_nograce(clp, state))
1417 clp->cl_hostname);
1418 nfs4_schedule_state_manager(clp);
1455 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
1467 nfs4_state_mark_reclaim_nograce(clp, state)) {
1473 nfs4_state_mark_reclaim_nograce(clp, state)) {
1478 nfs4_state_mark_reclaim_nograce(clp, state))
1485 nfs4_schedule_state_manager(clp);
1765 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1767 struct nfs_client *clp = server->nfs_client;
1772 spin_lock(&clp->cl_lock);
1780 if (mark_reclaim(clp, state))
1785 spin_unlock(&clp->cl_lock);
1788 static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp,
1789 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1794 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1799 static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
1801 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1803 nfs_delegation_mark_reclaim(clp);
1804 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot);
1807 static int nfs4_reclaim_complete(struct nfs_client *clp,
1813 return ops->reclaim_complete(clp, cred);
1819 struct nfs_client *clp = server->nfs_client;
1824 spin_lock(&clp->cl_lock);
1834 nfs4_state_mark_reclaim_nograce(clp, state);
1838 spin_unlock(&clp->cl_lock);
1841 static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp)
1845 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
1849 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1853 nfs_delegation_reap_unclaimed(clp);
1857 static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
1863 if (!nfs4_state_clear_reclaim_reboot(clp))
1865 ops = clp->cl_mvops->reboot_recovery_ops;
1866 cred = nfs4_get_clid_cred(clp);
1867 err = nfs4_reclaim_complete(clp, ops, cred);
1870 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1873 static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp)
1875 nfs_mark_test_expired_all_delegations(clp);
1876 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce);
1879 static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
1885 nfs40_handle_cb_pathdown(clp);
1888 nfs4_state_end_reclaim_reboot(clp);
1891 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1892 nfs4_state_start_reclaim_reboot(clp);
1895 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1896 nfs4_state_start_reclaim_nograce(clp);
1904 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
1908 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
1912 __func__, error, clp->cl_hostname);
1916 clp->cl_hostname);
1920 static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
1930 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
1932 spin_lock(&clp->cl_lock);
1943 spin_unlock(&clp->cl_lock);
1950 status = nfs4_recovery_handle_error(clp, status);
1957 spin_unlock(&clp->cl_lock);
1964 static int nfs4_check_lease(struct nfs_client *clp)
1968 clp->cl_mvops->state_renewal_ops;
1972 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1974 cred = ops->get_state_renewal_cred(clp);
1976 cred = nfs4_get_clid_cred(clp);
1981 status = ops->renew_lease(clp, cred);
1984 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
1988 return nfs4_recovery_handle_error(clp, status);
1994 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
1998 if (test_and_set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state))
2002 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2005 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2006 nfs4_state_start_reclaim_reboot(clp);
2010 clp->cl_hostname);
2011 nfs_mark_client_ready(clp, -EPERM);
2012 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2021 if (clp->cl_cons_state == NFS_CS_SESSION_INITING)
2022 nfs_mark_client_ready(clp, -EPROTONOSUPPORT);
2024 __func__, -EPROTONOSUPPORT, clp->cl_hostname);
2030 status, clp->cl_hostname);
2033 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2035 clp->cl_hostname);
2039 static int nfs4_establish_lease(struct nfs_client *clp)
2043 clp->cl_mvops->reboot_recovery_ops;
2046 status = nfs4_begin_drain_session(clp);
2049 cred = nfs4_get_clid_cred(clp);
2052 status = ops->establish_clid(clp, cred);
2056 pnfs_destroy_all_layouts(clp);
2064 static int nfs4_reclaim_lease(struct nfs_client *clp)
2068 status = nfs4_establish_lease(clp);
2070 return nfs4_handle_reclaim_lease_error(clp, status);
2071 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state))
2072 nfs4_state_start_reclaim_nograce(clp);
2073 if (!test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
2074 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
2075 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
2076 clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2080 static int nfs4_purge_lease(struct nfs_client *clp)
2084 status = nfs4_establish_lease(clp);
2086 return nfs4_handle_reclaim_lease_error(clp, status);
2087 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
2088 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2089 nfs4_state_start_reclaim_nograce(clp);
2102 struct nfs_client *clp = server->nfs_client;
2111 clp->cl_hostname);
2139 status = nfs4_begin_drain_session(clp);
2161 clp->cl_hostname);
2170 static int nfs4_handle_migration(struct nfs_client *clp)
2173 clp->cl_mvops->state_renewal_ops;
2178 clp->cl_hostname);
2180 cred = ops->get_state_renewal_cred(clp);
2184 clp->cl_mig_gen++;
2187 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
2190 if (server->mig_gen == clp->cl_mig_gen)
2192 server->mig_gen = clp->cl_mig_gen;
2212 * Test each nfs_server on the clp's cl_superblocks list to see
2216 static int nfs4_handle_lease_moved(struct nfs_client *clp)
2219 clp->cl_mvops->state_renewal_ops;
2224 clp->cl_hostname);
2226 cred = ops->get_state_renewal_cred(clp);
2230 clp->cl_mig_gen++;
2233 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
2237 if (server->mig_gen == clp->cl_mig_gen)
2239 server->mig_gen = clp->cl_mig_gen;
2261 * @clp: nfs_client under test
2262 * @result: OUT: found nfs_client, or clp
2271 int nfs4_discover_server_trunking(struct nfs_client *clp,
2275 clp->cl_mvops->reboot_recovery_ops;
2280 dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname);
2282 clnt = clp->cl_rpcclient;
2288 cred = nfs4_get_clid_cred(clp);
2292 status = ops->detect_trunking(clp, result, cred);
2313 nfs4_root_machine_cred(clp);
2333 * clp->cl_rpcclient
2335 clnt = xchg(&clp->cl_rpcclient, clnt);
2337 clnt = clp->cl_rpcclient;
2364 struct nfs_client *clp = session->clp;
2368 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2371 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2373 nfs4_schedule_state_manager(clp);
2377 void nfs41_notify_server(struct nfs_client *clp)
2380 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
2381 nfs4_schedule_state_manager(clp);
2384 static void nfs4_reset_all_state(struct nfs_client *clp)
2386 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) {
2387 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
2388 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2389 nfs4_state_start_reclaim_nograce(clp);
2391 __func__, clp->cl_hostname);
2392 nfs4_schedule_state_manager(clp);
2396 static void nfs41_handle_server_reboot(struct nfs_client *clp)
2398 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) {
2399 nfs4_state_start_reclaim_reboot(clp);
2401 clp->cl_hostname);
2402 nfs4_schedule_state_manager(clp);
2406 static void nfs41_handle_all_state_revoked(struct nfs_client *clp)
2408 nfs4_reset_all_state(clp);
2409 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname);
2412 static void nfs41_handle_some_state_revoked(struct nfs_client *clp)
2414 nfs4_state_start_reclaim_nograce(clp);
2415 nfs4_schedule_state_manager(clp);
2417 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname);
2420 static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)
2423 pnfs_destroy_all_layouts(clp);
2424 nfs_test_expired_all_delegations(clp);
2426 clp->cl_hostname);
2429 static void nfs41_handle_backchannel_fault(struct nfs_client *clp)
2431 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2432 nfs4_schedule_state_manager(clp);
2435 clp->cl_hostname);
2438 static void nfs41_handle_cb_path_down(struct nfs_client *clp)
2441 &clp->cl_state) == 0)
2442 nfs4_schedule_state_manager(clp);
2445 void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags,
2452 __func__, clp->cl_hostname, clp->cl_clientid, flags);
2463 nfs41_handle_server_reboot(clp);
2465 nfs41_handle_all_state_revoked(clp);
2468 nfs41_handle_some_state_revoked(clp);
2470 nfs4_schedule_lease_moved_recovery(clp);
2472 nfs41_handle_recallable_state_revoked(clp);
2475 nfs41_handle_backchannel_fault(clp);
2478 nfs41_handle_cb_path_down(clp);
2481 static int nfs4_reset_session(struct nfs_client *clp)
2486 if (!nfs4_has_session(clp))
2488 status = nfs4_begin_drain_session(clp);
2491 cred = nfs4_get_clid_cred(clp);
2492 status = nfs4_proc_destroy_session(clp->cl_session, cred);
2500 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2505 status = nfs4_recovery_handle_error(clp, status);
2509 memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
2510 status = nfs4_proc_create_session(clp, cred);
2513 __func__, status, clp->cl_hostname);
2514 status = nfs4_handle_reclaim_lease_error(clp, status);
2517 nfs41_finish_session_reset(clp);
2519 __func__, clp->cl_hostname);
2525 static int nfs4_bind_conn_to_session(struct nfs_client *clp)
2530 if (!nfs4_has_session(clp))
2532 ret = nfs4_begin_drain_session(clp);
2535 cred = nfs4_get_clid_cred(clp);
2536 ret = nfs4_proc_bind_conn_to_session(clp, cred);
2538 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2542 __func__, clp->cl_hostname);
2546 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2549 return nfs4_recovery_handle_error(clp, ret);
2554 static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
2558 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_READ, &clp->cl_state))
2560 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_RW, &clp->cl_state))
2564 pnfs_layout_return_unused_byclid(clp, iomode);
2565 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2569 static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
2571 static int nfs4_bind_conn_to_session(struct nfs_client *clp)
2576 static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
2581 static void nfs4_state_manager(struct nfs_client *clp)
2596 trace_nfs4_state_mgr(clp);
2597 clear_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2598 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) {
2600 status = nfs4_purge_lease(clp);
2606 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
2609 status = nfs4_reclaim_lease(clp);
2616 if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) {
2618 status = nfs4_reset_session(clp);
2619 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
2627 &clp->cl_state)) {
2629 status = nfs4_bind_conn_to_session(clp);
2635 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
2637 status = nfs4_check_lease(clp);
2643 if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
2645 status = nfs4_handle_migration(clp);
2650 if (test_and_clear_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state)) {
2652 status = nfs4_handle_lease_moved(clp);
2658 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
2660 status = nfs4_do_reclaim(clp,
2661 clp->cl_mvops->reboot_recovery_ops);
2666 nfs4_state_end_reclaim_reboot(clp);
2671 if (test_and_clear_bit(NFS4CLNT_DELEGATION_EXPIRED, &clp->cl_state)) {
2673 nfs_reap_expired_delegations(clp);
2678 if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
2680 status = nfs4_do_reclaim(clp,
2681 clp->cl_mvops->nograce_recovery_ops);
2686 clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
2690 nfs4_end_drain_session(clp);
2691 nfs4_clear_state_manager_bit(clp);
2693 if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2695 &clp->cl_state)) {
2700 if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
2701 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
2702 nfs_client_return_marked_delegations(clp);
2703 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2705 nfs4_layoutreturn_any_run(clp);
2706 clear_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state);
2711 } while (refcount_read(&clp->cl_count) > 1 && !signalled());
2717 trace_nfs4_state_mgr_failed(clp, section, status);
2720 clp->cl_hostname, -status);
2724 nfs4_end_drain_session(clp);
2725 nfs4_clear_state_manager_bit(clp);
2730 struct nfs_client *clp = ptr;
2731 struct rpc_clnt *cl = clp->cl_rpcclient;
2738 nfs4_state_manager(clp);
2740 if (test_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) &&
2741 !test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state)) {
2742 wait_var_event_interruptible(&clp->cl_state,
2744 &clp->cl_state));
2746 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2747 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2748 !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
2751 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2754 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2755 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2756 !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
2759 nfs_put_client(clp);