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);
546 struct nfs_client *clp = server->nfs_client;
551 spin_lock(&clp->cl_lock);
553 time_min = (long)time_max - (long)clp->cl_lease_time;
561 spin_unlock(&clp->cl_lock);
581 struct nfs_client *clp = server->nfs_client;
584 spin_lock(&clp->cl_lock);
586 spin_unlock(&clp->cl_lock);
592 spin_lock(&clp->cl_lock);
594 spin_unlock(&clp->cl_lock);
617 struct nfs_client *clp = server->nfs_client;
619 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
624 spin_unlock(&clp->cl_lock);
640 struct nfs_client *clp = server->nfs_client;
643 spin_lock(&clp->cl_lock);
648 spin_unlock(&clp->cl_lock);
952 struct nfs_client *clp = server->nfs_client;
954 clp->cl_mvops->free_lock_state(server, lsp);
1199 static void nfs4_clear_state_manager_bit(struct nfs_client *clp)
1201 clear_and_wake_up_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
1202 rpc_wake_up(&clp->cl_rpcwaitq);
1208 void nfs4_schedule_state_manager(struct nfs_client *clp)
1212 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,
1335 if (clp->cl_cons_state < 0)
1336 res = clp->cl_cons_state;
1338 nfs_put_client(clp);
1342 int nfs4_client_recover_expired_lease(struct nfs_client *clp)
1348 ret = nfs4_wait_clnt_recover(clp);
1351 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1352 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state))
1354 nfs4_schedule_state_manager(clp);
1362 * @clp: client to process
1368 static void nfs40_handle_cb_pathdown(struct nfs_client *clp)
1370 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1371 nfs_expire_all_delegations(clp);
1373 clp->cl_hostname);
1376 void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
1378 nfs40_handle_cb_pathdown(clp);
1379 nfs4_schedule_state_manager(clp);
1382 static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
1394 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1398 int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state)
1405 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
1411 struct nfs_client *clp = server->nfs_client;
1413 if (!nfs4_state_mark_reclaim_nograce(clp, state))
1418 clp->cl_hostname);
1419 nfs4_schedule_state_manager(clp);
1456 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
1468 nfs4_state_mark_reclaim_nograce(clp, state)) {
1474 nfs4_state_mark_reclaim_nograce(clp, state)) {
1479 nfs4_state_mark_reclaim_nograce(clp, state))
1486 nfs4_schedule_state_manager(clp);
1770 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1772 struct nfs_client *clp = server->nfs_client;
1777 spin_lock(&clp->cl_lock);
1785 if (mark_reclaim(clp, state))
1790 spin_unlock(&clp->cl_lock);
1793 static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp,
1794 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
1799 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1804 static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
1806 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1808 nfs_delegation_mark_reclaim(clp);
1809 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot);
1812 static int nfs4_reclaim_complete(struct nfs_client *clp,
1818 return ops->reclaim_complete(clp, cred);
1824 struct nfs_client *clp = server->nfs_client;
1829 spin_lock(&clp->cl_lock);
1839 nfs4_state_mark_reclaim_nograce(clp, state);
1843 spin_unlock(&clp->cl_lock);
1846 static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp)
1850 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
1854 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link)
1858 nfs_delegation_reap_unclaimed(clp);
1862 static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
1868 if (!nfs4_state_clear_reclaim_reboot(clp))
1870 ops = clp->cl_mvops->reboot_recovery_ops;
1871 cred = nfs4_get_clid_cred(clp);
1872 err = nfs4_reclaim_complete(clp, ops, cred);
1875 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1878 static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp)
1880 nfs_mark_test_expired_all_delegations(clp);
1881 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce);
1884 static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
1890 nfs40_handle_cb_pathdown(clp);
1893 nfs4_state_end_reclaim_reboot(clp);
1896 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1897 nfs4_state_start_reclaim_reboot(clp);
1900 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1901 nfs4_state_start_reclaim_nograce(clp);
1909 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
1913 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
1917 __func__, error, clp->cl_hostname);
1921 clp->cl_hostname);
1925 static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
1936 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
1938 spin_lock(&clp->cl_lock);
1949 spin_unlock(&clp->cl_lock);
1956 clp->cl_hostname, lost_locks);
1959 status = nfs4_recovery_handle_error(clp, status);
1966 spin_unlock(&clp->cl_lock);
1972 clp->cl_hostname, lost_locks);
1976 static int nfs4_check_lease(struct nfs_client *clp)
1980 clp->cl_mvops->state_renewal_ops;
1984 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1986 cred = ops->get_state_renewal_cred(clp);
1988 cred = nfs4_get_clid_cred(clp);
1993 status = ops->renew_lease(clp, cred);
1996 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
2000 return nfs4_recovery_handle_error(clp, status);
2006 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
2010 if (test_and_set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state))
2014 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2017 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2018 nfs4_state_start_reclaim_reboot(clp);
2022 clp->cl_hostname);
2023 nfs_mark_client_ready(clp, -EPERM);
2024 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2033 if (clp->cl_cons_state == NFS_CS_SESSION_INITING)
2034 nfs_mark_client_ready(clp, -EPROTONOSUPPORT);
2036 __func__, -EPROTONOSUPPORT, clp->cl_hostname);
2039 if (clp->cl_cons_state == NFS_CS_SESSION_INITING)
2040 nfs_mark_client_ready(clp, -EIO);
2046 status, clp->cl_hostname);
2049 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2051 clp->cl_hostname);
2055 static int nfs4_establish_lease(struct nfs_client *clp)
2059 clp->cl_mvops->reboot_recovery_ops;
2062 status = nfs4_begin_drain_session(clp);
2065 cred = nfs4_get_clid_cred(clp);
2068 status = ops->establish_clid(clp, cred);
2072 pnfs_destroy_all_layouts(clp);
2080 static int nfs4_reclaim_lease(struct nfs_client *clp)
2084 status = nfs4_establish_lease(clp);
2086 return nfs4_handle_reclaim_lease_error(clp, status);
2087 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state))
2088 nfs4_state_start_reclaim_nograce(clp);
2089 if (!test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
2090 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
2091 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
2092 clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2096 static int nfs4_purge_lease(struct nfs_client *clp)
2100 status = nfs4_establish_lease(clp);
2102 return nfs4_handle_reclaim_lease_error(clp, status);
2103 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
2104 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
2105 nfs4_state_start_reclaim_nograce(clp);
2118 struct nfs_client *clp = server->nfs_client;
2127 clp->cl_hostname);
2161 status = nfs4_begin_drain_session(clp);
2185 clp->cl_hostname);
2194 static int nfs4_handle_migration(struct nfs_client *clp)
2197 clp->cl_mvops->state_renewal_ops;
2202 clp->cl_hostname);
2204 cred = ops->get_state_renewal_cred(clp);
2208 clp->cl_mig_gen++;
2211 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
2214 if (server->mig_gen == clp->cl_mig_gen)
2216 server->mig_gen = clp->cl_mig_gen;
2236 * Test each nfs_server on the clp's cl_superblocks list to see
2240 static int nfs4_handle_lease_moved(struct nfs_client *clp)
2243 clp->cl_mvops->state_renewal_ops;
2248 clp->cl_hostname);
2250 cred = ops->get_state_renewal_cred(clp);
2254 clp->cl_mig_gen++;
2257 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
2261 if (server->mig_gen == clp->cl_mig_gen)
2263 server->mig_gen = clp->cl_mig_gen;
2285 * @clp: nfs_client under test
2286 * @result: OUT: found nfs_client, or clp
2295 int nfs4_discover_server_trunking(struct nfs_client *clp,
2299 clp->cl_mvops->reboot_recovery_ops;
2304 dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname);
2306 clnt = clp->cl_rpcclient;
2312 cred = nfs4_get_clid_cred(clp);
2316 status = ops->detect_trunking(clp, result, cred);
2337 nfs4_root_machine_cred(clp);
2357 * clp->cl_rpcclient
2359 clnt = xchg(&clp->cl_rpcclient, clnt);
2361 clnt = clp->cl_rpcclient;
2388 struct nfs_client *clp = session->clp;
2392 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2395 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2397 nfs4_schedule_state_manager(clp);
2401 void nfs41_notify_server(struct nfs_client *clp)
2404 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
2405 nfs4_schedule_state_manager(clp);
2408 static void nfs4_reset_all_state(struct nfs_client *clp)
2410 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) {
2411 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
2412 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
2413 nfs4_state_start_reclaim_nograce(clp);
2415 __func__, clp->cl_hostname);
2416 nfs4_schedule_state_manager(clp);
2420 static void nfs41_handle_server_reboot(struct nfs_client *clp)
2422 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) {
2423 nfs4_state_start_reclaim_reboot(clp);
2425 clp->cl_hostname);
2426 nfs4_schedule_state_manager(clp);
2430 static void nfs41_handle_all_state_revoked(struct nfs_client *clp)
2432 nfs4_reset_all_state(clp);
2433 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname);
2436 static void nfs41_handle_some_state_revoked(struct nfs_client *clp)
2438 nfs4_state_start_reclaim_nograce(clp);
2439 nfs4_schedule_state_manager(clp);
2441 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname);
2444 static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)
2447 pnfs_destroy_all_layouts(clp);
2448 nfs_test_expired_all_delegations(clp);
2450 clp->cl_hostname);
2453 static void nfs41_handle_backchannel_fault(struct nfs_client *clp)
2455 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2456 nfs4_schedule_state_manager(clp);
2459 clp->cl_hostname);
2462 static void nfs41_handle_cb_path_down(struct nfs_client *clp)
2465 &clp->cl_state) == 0)
2466 nfs4_schedule_state_manager(clp);
2469 void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags,
2476 __func__, clp->cl_hostname, clp->cl_clientid, flags);
2487 nfs41_handle_server_reboot(clp);
2489 nfs41_handle_all_state_revoked(clp);
2492 nfs41_handle_some_state_revoked(clp);
2494 nfs4_schedule_lease_moved_recovery(clp);
2496 nfs41_handle_recallable_state_revoked(clp);
2499 nfs41_handle_backchannel_fault(clp);
2502 nfs41_handle_cb_path_down(clp);
2505 static int nfs4_reset_session(struct nfs_client *clp)
2510 if (!nfs4_has_session(clp))
2512 status = nfs4_begin_drain_session(clp);
2515 cred = nfs4_get_clid_cred(clp);
2516 status = nfs4_proc_destroy_session(clp->cl_session, cred);
2524 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2529 status = nfs4_recovery_handle_error(clp, status);
2533 memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
2534 status = nfs4_proc_create_session(clp, cred);
2537 __func__, status, clp->cl_hostname);
2538 status = nfs4_handle_reclaim_lease_error(clp, status);
2541 nfs41_finish_session_reset(clp);
2543 __func__, clp->cl_hostname);
2549 static int nfs4_bind_conn_to_session(struct nfs_client *clp)
2554 if (!nfs4_has_session(clp))
2556 ret = nfs4_begin_drain_session(clp);
2559 cred = nfs4_get_clid_cred(clp);
2560 ret = nfs4_proc_bind_conn_to_session(clp, cred);
2562 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2566 __func__, clp->cl_hostname);
2570 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
2573 return nfs4_recovery_handle_error(clp, ret);
2578 static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
2582 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_READ, &clp->cl_state))
2584 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_RW, &clp->cl_state))
2588 pnfs_layout_return_unused_byclid(clp, iomode);
2589 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2593 static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
2595 static int nfs4_bind_conn_to_session(struct nfs_client *clp)
2600 static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
2605 static void nfs4_state_manager(struct nfs_client *clp)
2620 trace_nfs4_state_mgr(clp);
2621 clear_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2622 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) {
2624 status = nfs4_purge_lease(clp);
2630 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
2633 status = nfs4_reclaim_lease(clp);
2640 if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) {
2642 status = nfs4_reset_session(clp);
2643 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
2651 &clp->cl_state)) {
2653 status = nfs4_bind_conn_to_session(clp);
2659 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
2661 status = nfs4_check_lease(clp);
2667 if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
2669 status = nfs4_handle_migration(clp);
2674 if (test_and_clear_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state)) {
2676 status = nfs4_handle_lease_moved(clp);
2682 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
2684 status = nfs4_do_reclaim(clp,
2685 clp->cl_mvops->reboot_recovery_ops);
2690 nfs4_state_end_reclaim_reboot(clp);
2695 if (test_and_clear_bit(NFS4CLNT_DELEGATION_EXPIRED, &clp->cl_state)) {
2697 nfs_reap_expired_delegations(clp);
2702 if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
2704 status = nfs4_do_reclaim(clp,
2705 clp->cl_mvops->nograce_recovery_ops);
2710 clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
2714 nfs4_end_drain_session(clp);
2715 nfs4_clear_state_manager_bit(clp);
2717 if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2719 &clp->cl_state)) {
2724 if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
2725 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
2726 nfs_client_return_marked_delegations(clp);
2727 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
2729 nfs4_layoutreturn_any_run(clp);
2730 clear_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state);
2735 } while (refcount_read(&clp->cl_count) > 1 && !signalled());
2741 trace_nfs4_state_mgr_failed(clp, section, status);
2744 clp->cl_hostname, -status);
2748 nfs4_end_drain_session(clp);
2749 nfs4_clear_state_manager_bit(clp);
2754 struct nfs_client *clp = ptr;
2755 struct rpc_clnt *cl = clp->cl_rpcclient;
2762 nfs4_state_manager(clp);
2764 if (test_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) &&
2765 !test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state)) {
2766 wait_var_event_interruptible(&clp->cl_state,
2768 &clp->cl_state));
2770 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2771 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2772 !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
2775 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2778 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2779 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2780 !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
2783 nfs_put_client(clp);