Lines Matching refs:clp

92 static int nfs4_setup_state_renewal(struct nfs_client *clp)  in nfs4_setup_state_renewal()  argument
97 if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { in nfs4_setup_state_renewal()
98 nfs4_schedule_state_renewal(clp); in nfs4_setup_state_renewal()
102 status = nfs4_proc_get_lease_time(clp, &fsinfo); in nfs4_setup_state_renewal()
104 nfs4_set_lease_period(clp, fsinfo.lease_time * HZ); in nfs4_setup_state_renewal()
105 nfs4_schedule_state_renewal(clp); in nfs4_setup_state_renewal()
111 int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred) in nfs4_init_clientid() argument
114 .clientid = clp->cl_clientid, in nfs4_init_clientid()
115 .confirm = clp->cl_confirm, in nfs4_init_clientid()
119 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs4_init_clientid()
121 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) in nfs4_init_clientid()
124 if (clp->cl_addr.ss_family == AF_INET6) in nfs4_init_clientid()
127 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); in nfs4_init_clientid()
130 clp->cl_clientid = clid.clientid; in nfs4_init_clientid()
131 clp->cl_confirm = clid.confirm; in nfs4_init_clientid()
132 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_init_clientid()
134 status = nfs4_proc_setclientid_confirm(clp, &clid, cred); in nfs4_init_clientid()
137 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_init_clientid()
138 nfs4_setup_state_renewal(clp); in nfs4_init_clientid()
156 int nfs40_discover_server_trunking(struct nfs_client *clp, in nfs40_discover_server_trunking() argument
161 .clientid = clp->cl_clientid, in nfs40_discover_server_trunking()
162 .confirm = clp->cl_confirm, in nfs40_discover_server_trunking()
164 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs40_discover_server_trunking()
169 if (clp->cl_addr.ss_family == AF_INET6) in nfs40_discover_server_trunking()
172 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); in nfs40_discover_server_trunking()
175 clp->cl_clientid = clid.clientid; in nfs40_discover_server_trunking()
176 clp->cl_confirm = clid.confirm; in nfs40_discover_server_trunking()
178 status = nfs40_walk_client_list(clp, result, cred); in nfs40_discover_server_trunking()
185 if (clp->cl_state) in nfs40_discover_server_trunking()
186 nfs4_schedule_state_manager(clp); in nfs40_discover_server_trunking()
192 const struct cred *nfs4_get_machine_cred(struct nfs_client *clp) in nfs4_get_machine_cred() argument
197 static void nfs4_root_machine_cred(struct nfs_client *clp) in nfs4_root_machine_cred() argument
201 clp->cl_principal = NULL; in nfs4_root_machine_cred()
202 clp->cl_rpcclient->cl_principal = NULL; in nfs4_root_machine_cred()
231 const struct cred *nfs4_get_renew_cred(struct nfs_client *clp) in nfs4_get_renew_cred() argument
237 cred = nfs4_get_machine_cred(clp); in nfs4_get_renew_cred()
241 spin_lock(&clp->cl_lock); in nfs4_get_renew_cred()
243 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_get_renew_cred()
249 spin_unlock(&clp->cl_lock); in nfs4_get_renew_cred()
264 static void nfs4_end_drain_session(struct nfs_client *clp) in nfs4_end_drain_session() argument
266 struct nfs4_session *ses = clp->cl_session; in nfs4_end_drain_session()
268 if (clp->cl_slot_tbl) { in nfs4_end_drain_session()
269 nfs4_end_drain_slot_table(clp->cl_slot_tbl); in nfs4_end_drain_session()
292 static int nfs4_begin_drain_session(struct nfs_client *clp) in nfs4_begin_drain_session() argument
294 struct nfs4_session *ses = clp->cl_session; in nfs4_begin_drain_session()
297 if (clp->cl_slot_tbl) in nfs4_begin_drain_session()
298 return nfs4_drain_slot_tbl(clp->cl_slot_tbl); in nfs4_begin_drain_session()
310 static void nfs41_finish_session_reset(struct nfs_client *clp) in nfs41_finish_session_reset() argument
312 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_finish_session_reset()
313 clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs41_finish_session_reset()
315 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs41_finish_session_reset()
316 nfs4_setup_state_renewal(clp); in nfs41_finish_session_reset()
319 int nfs41_init_clientid(struct nfs_client *clp, const struct cred *cred) in nfs41_init_clientid() argument
323 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) in nfs41_init_clientid()
325 status = nfs4_proc_exchange_id(clp, cred); in nfs41_init_clientid()
328 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_init_clientid()
330 status = nfs4_proc_create_session(clp, cred); in nfs41_init_clientid()
333 nfs41_finish_session_reset(clp); in nfs41_init_clientid()
334 nfs_mark_client_ready(clp, NFS_CS_READY); in nfs41_init_clientid()
352 int nfs41_discover_server_trunking(struct nfs_client *clp, in nfs41_discover_server_trunking() argument
358 status = nfs4_proc_exchange_id(clp, cred); in nfs41_discover_server_trunking()
362 status = nfs41_walk_client_list(clp, result, cred); in nfs41_discover_server_trunking()
365 if (clp != *result) in nfs41_discover_server_trunking()
373 if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R) { in nfs41_discover_server_trunking()
374 if (!test_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags)) in nfs41_discover_server_trunking()
375 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs41_discover_server_trunking()
377 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_discover_server_trunking()
379 nfs4_schedule_state_manager(clp); in nfs41_discover_server_trunking()
380 status = nfs_wait_client_init_complete(clp); in nfs41_discover_server_trunking()
382 nfs_put_client(clp); in nfs41_discover_server_trunking()
394 const struct cred *nfs4_get_clid_cred(struct nfs_client *clp) in nfs4_get_clid_cred() argument
398 cred = nfs4_get_machine_cred(clp); in nfs4_get_clid_cred()
542 struct nfs_client *clp = server->nfs_client; in nfs4_gc_state_owners() local
547 spin_lock(&clp->cl_lock); in nfs4_gc_state_owners()
549 time_min = (long)time_max - (long)clp->cl_lease_time; in nfs4_gc_state_owners()
557 spin_unlock(&clp->cl_lock); in nfs4_gc_state_owners()
577 struct nfs_client *clp = server->nfs_client; in nfs4_get_state_owner() local
580 spin_lock(&clp->cl_lock); in nfs4_get_state_owner()
582 spin_unlock(&clp->cl_lock); in nfs4_get_state_owner()
588 spin_lock(&clp->cl_lock); in nfs4_get_state_owner()
590 spin_unlock(&clp->cl_lock); in nfs4_get_state_owner()
613 struct nfs_client *clp = server->nfs_client; in nfs4_put_state_owner() local
615 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) in nfs4_put_state_owner()
620 spin_unlock(&clp->cl_lock); in nfs4_put_state_owner()
636 struct nfs_client *clp = server->nfs_client; in nfs4_purge_state_owners() local
639 spin_lock(&clp->cl_lock); in nfs4_purge_state_owners()
644 spin_unlock(&clp->cl_lock); in nfs4_purge_state_owners()
948 struct nfs_client *clp = server->nfs_client; in nfs4_put_lock_state() local
950 clp->cl_mvops->free_lock_state(server, lsp); in nfs4_put_lock_state()
1195 static void nfs4_clear_state_manager_bit(struct nfs_client *clp) in nfs4_clear_state_manager_bit() argument
1197 clear_and_wake_up_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); in nfs4_clear_state_manager_bit()
1198 rpc_wake_up(&clp->cl_rpcwaitq); in nfs4_clear_state_manager_bit()
1204 void nfs4_schedule_state_manager(struct nfs_client *clp) in nfs4_schedule_state_manager() argument
1208 struct rpc_clnt *cl = clp->cl_rpcclient; in nfs4_schedule_state_manager()
1213 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state); in nfs4_schedule_state_manager()
1214 if (test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) != 0) { in nfs4_schedule_state_manager()
1215 wake_up_var(&clp->cl_state); in nfs4_schedule_state_manager()
1218 set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); in nfs4_schedule_state_manager()
1220 refcount_inc(&clp->cl_count); in nfs4_schedule_state_manager()
1227 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); in nfs4_schedule_state_manager()
1229 task = kthread_run(nfs4_run_state_manager, clp, "%s", buf); in nfs4_schedule_state_manager()
1233 if (!nfs_client_init_is_complete(clp)) in nfs4_schedule_state_manager()
1234 nfs_mark_client_ready(clp, PTR_ERR(task)); in nfs4_schedule_state_manager()
1235 nfs4_clear_state_manager_bit(clp); in nfs4_schedule_state_manager()
1236 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state); in nfs4_schedule_state_manager()
1237 nfs_put_client(clp); in nfs4_schedule_state_manager()
1245 void nfs4_schedule_lease_recovery(struct nfs_client *clp) in nfs4_schedule_lease_recovery() argument
1247 if (!clp) in nfs4_schedule_lease_recovery()
1249 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_schedule_lease_recovery()
1250 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_schedule_lease_recovery()
1252 clp->cl_hostname); in nfs4_schedule_lease_recovery()
1253 nfs4_schedule_state_manager(clp); in nfs4_schedule_lease_recovery()
1267 struct nfs_client *clp = server->nfs_client; in nfs4_schedule_migration_recovery() local
1271 clp->cl_hostname); in nfs4_schedule_migration_recovery()
1282 clp->cl_hostname); in nfs4_schedule_migration_recovery()
1286 set_bit(NFS4CLNT_MOVED, &clp->cl_state); in nfs4_schedule_migration_recovery()
1288 nfs4_schedule_state_manager(clp); in nfs4_schedule_migration_recovery()
1299 void nfs4_schedule_lease_moved_recovery(struct nfs_client *clp) in nfs4_schedule_lease_moved_recovery() argument
1302 __func__, clp->cl_clientid, clp->cl_hostname); in nfs4_schedule_lease_moved_recovery()
1304 set_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state); in nfs4_schedule_lease_moved_recovery()
1305 nfs4_schedule_state_manager(clp); in nfs4_schedule_lease_moved_recovery()
1309 int nfs4_wait_clnt_recover(struct nfs_client *clp) in nfs4_wait_clnt_recover() argument
1315 refcount_inc(&clp->cl_count); in nfs4_wait_clnt_recover()
1316 res = wait_on_bit_action(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING, in nfs4_wait_clnt_recover()
1321 if (clp->cl_cons_state < 0) in nfs4_wait_clnt_recover()
1322 res = clp->cl_cons_state; in nfs4_wait_clnt_recover()
1324 nfs_put_client(clp); in nfs4_wait_clnt_recover()
1328 int nfs4_client_recover_expired_lease(struct nfs_client *clp) in nfs4_client_recover_expired_lease() argument
1334 ret = nfs4_wait_clnt_recover(clp); in nfs4_client_recover_expired_lease()
1337 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && in nfs4_client_recover_expired_lease()
1338 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) in nfs4_client_recover_expired_lease()
1340 nfs4_schedule_state_manager(clp); in nfs4_client_recover_expired_lease()
1354 static void nfs40_handle_cb_pathdown(struct nfs_client *clp) in nfs40_handle_cb_pathdown() argument
1356 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs40_handle_cb_pathdown()
1357 nfs_expire_all_delegations(clp); in nfs40_handle_cb_pathdown()
1359 clp->cl_hostname); in nfs40_handle_cb_pathdown()
1362 void nfs4_schedule_path_down_recovery(struct nfs_client *clp) in nfs4_schedule_path_down_recovery() argument
1364 nfs40_handle_cb_pathdown(clp); in nfs4_schedule_path_down_recovery()
1365 nfs4_schedule_state_manager(clp); in nfs4_schedule_path_down_recovery()
1368 static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) in nfs4_state_mark_reclaim_reboot() argument
1380 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_state_mark_reclaim_reboot()
1384 int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state) in nfs4_state_mark_reclaim_nograce() argument
1391 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); in nfs4_state_mark_reclaim_nograce()
1397 struct nfs_client *clp = server->nfs_client; in nfs4_schedule_stateid_recovery() local
1399 if (!nfs4_state_mark_reclaim_nograce(clp, state)) in nfs4_schedule_stateid_recovery()
1404 clp->cl_hostname); in nfs4_schedule_stateid_recovery()
1405 nfs4_schedule_state_manager(clp); in nfs4_schedule_stateid_recovery()
1442 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; in nfs_inode_find_state_and_recover() local
1454 nfs4_state_mark_reclaim_nograce(clp, state)) { in nfs_inode_find_state_and_recover()
1460 nfs4_state_mark_reclaim_nograce(clp, state)) { in nfs_inode_find_state_and_recover()
1465 nfs4_state_mark_reclaim_nograce(clp, state)) in nfs_inode_find_state_and_recover()
1472 nfs4_schedule_state_manager(clp); in nfs_inode_find_state_and_recover()
1756 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state)) in nfs4_reset_seqids() argument
1758 struct nfs_client *clp = server->nfs_client; in nfs4_reset_seqids() local
1763 spin_lock(&clp->cl_lock); in nfs4_reset_seqids()
1771 if (mark_reclaim(clp, state)) in nfs4_reset_seqids()
1776 spin_unlock(&clp->cl_lock); in nfs4_reset_seqids()
1779 static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp, in nfs4_state_mark_reclaim_helper() argument
1780 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state)) in nfs4_state_mark_reclaim_helper() argument
1785 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) in nfs4_state_mark_reclaim_helper()
1790 static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) in nfs4_state_start_reclaim_reboot() argument
1792 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_state_start_reclaim_reboot()
1794 nfs_delegation_mark_reclaim(clp); in nfs4_state_start_reclaim_reboot()
1795 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot); in nfs4_state_start_reclaim_reboot()
1798 static int nfs4_reclaim_complete(struct nfs_client *clp, in nfs4_reclaim_complete() argument
1804 return ops->reclaim_complete(clp, cred); in nfs4_reclaim_complete()
1810 struct nfs_client *clp = server->nfs_client; in nfs4_clear_reclaim_server() local
1815 spin_lock(&clp->cl_lock); in nfs4_clear_reclaim_server()
1825 nfs4_state_mark_reclaim_nograce(clp, state); in nfs4_clear_reclaim_server()
1829 spin_unlock(&clp->cl_lock); in nfs4_clear_reclaim_server()
1832 static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) in nfs4_state_clear_reclaim_reboot() argument
1836 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) in nfs4_state_clear_reclaim_reboot()
1840 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) in nfs4_state_clear_reclaim_reboot()
1844 nfs_delegation_reap_unclaimed(clp); in nfs4_state_clear_reclaim_reboot()
1848 static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) in nfs4_state_end_reclaim_reboot() argument
1854 if (!nfs4_state_clear_reclaim_reboot(clp)) in nfs4_state_end_reclaim_reboot()
1856 ops = clp->cl_mvops->reboot_recovery_ops; in nfs4_state_end_reclaim_reboot()
1857 cred = nfs4_get_clid_cred(clp); in nfs4_state_end_reclaim_reboot()
1858 err = nfs4_reclaim_complete(clp, ops, cred); in nfs4_state_end_reclaim_reboot()
1861 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_state_end_reclaim_reboot()
1864 static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp) in nfs4_state_start_reclaim_nograce() argument
1866 nfs_mark_test_expired_all_delegations(clp); in nfs4_state_start_reclaim_nograce()
1867 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); in nfs4_state_start_reclaim_nograce()
1870 static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) in nfs4_recovery_handle_error() argument
1876 nfs40_handle_cb_pathdown(clp); in nfs4_recovery_handle_error()
1879 nfs4_state_end_reclaim_reboot(clp); in nfs4_recovery_handle_error()
1882 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_recovery_handle_error()
1883 nfs4_state_start_reclaim_reboot(clp); in nfs4_recovery_handle_error()
1886 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_recovery_handle_error()
1887 nfs4_state_start_reclaim_nograce(clp); in nfs4_recovery_handle_error()
1895 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_recovery_handle_error()
1899 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_recovery_handle_error()
1903 __func__, error, clp->cl_hostname); in nfs4_recovery_handle_error()
1907 clp->cl_hostname); in nfs4_recovery_handle_error()
1911 static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) in nfs4_do_reclaim() argument
1922 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_do_reclaim()
1924 spin_lock(&clp->cl_lock); in nfs4_do_reclaim()
1935 spin_unlock(&clp->cl_lock); in nfs4_do_reclaim()
1942 clp->cl_hostname, lost_locks); in nfs4_do_reclaim()
1945 status = nfs4_recovery_handle_error(clp, status); in nfs4_do_reclaim()
1952 spin_unlock(&clp->cl_lock); in nfs4_do_reclaim()
1958 clp->cl_hostname, lost_locks); in nfs4_do_reclaim()
1962 static int nfs4_check_lease(struct nfs_client *clp) in nfs4_check_lease() argument
1966 clp->cl_mvops->state_renewal_ops; in nfs4_check_lease()
1970 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_check_lease()
1972 cred = ops->get_state_renewal_cred(clp); in nfs4_check_lease()
1974 cred = nfs4_get_clid_cred(clp); in nfs4_check_lease()
1979 status = ops->renew_lease(clp, cred); in nfs4_check_lease()
1982 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_check_lease()
1986 return nfs4_recovery_handle_error(clp, status); in nfs4_check_lease()
1992 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) in nfs4_handle_reclaim_lease_error() argument
1996 if (test_and_set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) in nfs4_handle_reclaim_lease_error()
2000 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
2003 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
2004 nfs4_state_start_reclaim_reboot(clp); in nfs4_handle_reclaim_lease_error()
2008 clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
2009 nfs_mark_client_ready(clp, -EPERM); in nfs4_handle_reclaim_lease_error()
2010 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
2019 if (clp->cl_cons_state == NFS_CS_SESSION_INITING) in nfs4_handle_reclaim_lease_error()
2020 nfs_mark_client_ready(clp, -EPROTONOSUPPORT); in nfs4_handle_reclaim_lease_error()
2022 __func__, -EPROTONOSUPPORT, clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
2025 if (clp->cl_cons_state == NFS_CS_SESSION_INITING) in nfs4_handle_reclaim_lease_error()
2026 nfs_mark_client_ready(clp, -EIO); in nfs4_handle_reclaim_lease_error()
2032 status, clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
2035 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
2037 clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
2041 static int nfs4_establish_lease(struct nfs_client *clp) in nfs4_establish_lease() argument
2045 clp->cl_mvops->reboot_recovery_ops; in nfs4_establish_lease()
2048 status = nfs4_begin_drain_session(clp); in nfs4_establish_lease()
2051 cred = nfs4_get_clid_cred(clp); in nfs4_establish_lease()
2054 status = ops->establish_clid(clp, cred); in nfs4_establish_lease()
2058 pnfs_destroy_all_layouts(clp); in nfs4_establish_lease()
2066 static int nfs4_reclaim_lease(struct nfs_client *clp) in nfs4_reclaim_lease() argument
2070 status = nfs4_establish_lease(clp); in nfs4_reclaim_lease()
2072 return nfs4_handle_reclaim_lease_error(clp, status); in nfs4_reclaim_lease()
2073 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state)) in nfs4_reclaim_lease()
2074 nfs4_state_start_reclaim_nograce(clp); in nfs4_reclaim_lease()
2075 if (!test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) in nfs4_reclaim_lease()
2076 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_reclaim_lease()
2077 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_reclaim_lease()
2078 clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_reclaim_lease()
2082 static int nfs4_purge_lease(struct nfs_client *clp) in nfs4_purge_lease() argument
2086 status = nfs4_establish_lease(clp); in nfs4_purge_lease()
2088 return nfs4_handle_reclaim_lease_error(clp, status); in nfs4_purge_lease()
2089 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs4_purge_lease()
2090 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_purge_lease()
2091 nfs4_state_start_reclaim_nograce(clp); in nfs4_purge_lease()
2104 struct nfs_client *clp = server->nfs_client; in nfs4_try_migration() local
2113 clp->cl_hostname); in nfs4_try_migration()
2147 status = nfs4_begin_drain_session(clp); in nfs4_try_migration()
2171 clp->cl_hostname); in nfs4_try_migration()
2180 static int nfs4_handle_migration(struct nfs_client *clp) in nfs4_handle_migration() argument
2183 clp->cl_mvops->state_renewal_ops; in nfs4_handle_migration()
2188 clp->cl_hostname); in nfs4_handle_migration()
2190 cred = ops->get_state_renewal_cred(clp); in nfs4_handle_migration()
2194 clp->cl_mig_gen++; in nfs4_handle_migration()
2197 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_handle_migration()
2200 if (server->mig_gen == clp->cl_mig_gen) in nfs4_handle_migration()
2202 server->mig_gen = clp->cl_mig_gen; in nfs4_handle_migration()
2226 static int nfs4_handle_lease_moved(struct nfs_client *clp) in nfs4_handle_lease_moved() argument
2229 clp->cl_mvops->state_renewal_ops; in nfs4_handle_lease_moved()
2234 clp->cl_hostname); in nfs4_handle_lease_moved()
2236 cred = ops->get_state_renewal_cred(clp); in nfs4_handle_lease_moved()
2240 clp->cl_mig_gen++; in nfs4_handle_lease_moved()
2243 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_handle_lease_moved()
2247 if (server->mig_gen == clp->cl_mig_gen) in nfs4_handle_lease_moved()
2249 server->mig_gen = clp->cl_mig_gen; in nfs4_handle_lease_moved()
2281 int nfs4_discover_server_trunking(struct nfs_client *clp, in nfs4_discover_server_trunking() argument
2285 clp->cl_mvops->reboot_recovery_ops; in nfs4_discover_server_trunking()
2290 dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname); in nfs4_discover_server_trunking()
2292 clnt = clp->cl_rpcclient; in nfs4_discover_server_trunking()
2298 cred = nfs4_get_clid_cred(clp); in nfs4_discover_server_trunking()
2302 status = ops->detect_trunking(clp, result, cred); in nfs4_discover_server_trunking()
2323 nfs4_root_machine_cred(clp); in nfs4_discover_server_trunking()
2345 clnt = xchg(&clp->cl_rpcclient, clnt); in nfs4_discover_server_trunking()
2347 clnt = clp->cl_rpcclient; in nfs4_discover_server_trunking()
2374 struct nfs_client *clp = session->clp; in nfs4_schedule_session_recovery() local
2378 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_schedule_session_recovery()
2381 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_schedule_session_recovery()
2383 nfs4_schedule_state_manager(clp); in nfs4_schedule_session_recovery()
2387 void nfs41_notify_server(struct nfs_client *clp) in nfs41_notify_server() argument
2390 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs41_notify_server()
2391 nfs4_schedule_state_manager(clp); in nfs41_notify_server()
2394 static void nfs4_reset_all_state(struct nfs_client *clp) in nfs4_reset_all_state() argument
2396 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { in nfs4_reset_all_state()
2397 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs4_reset_all_state()
2398 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_reset_all_state()
2399 nfs4_state_start_reclaim_nograce(clp); in nfs4_reset_all_state()
2401 __func__, clp->cl_hostname); in nfs4_reset_all_state()
2402 nfs4_schedule_state_manager(clp); in nfs4_reset_all_state()
2406 static void nfs41_handle_server_reboot(struct nfs_client *clp) in nfs41_handle_server_reboot() argument
2408 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { in nfs41_handle_server_reboot()
2409 nfs4_state_start_reclaim_reboot(clp); in nfs41_handle_server_reboot()
2411 clp->cl_hostname); in nfs41_handle_server_reboot()
2412 nfs4_schedule_state_manager(clp); in nfs41_handle_server_reboot()
2416 static void nfs41_handle_all_state_revoked(struct nfs_client *clp) in nfs41_handle_all_state_revoked() argument
2418 nfs4_reset_all_state(clp); in nfs41_handle_all_state_revoked()
2419 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname); in nfs41_handle_all_state_revoked()
2422 static void nfs41_handle_some_state_revoked(struct nfs_client *clp) in nfs41_handle_some_state_revoked() argument
2424 nfs4_state_start_reclaim_nograce(clp); in nfs41_handle_some_state_revoked()
2425 nfs4_schedule_state_manager(clp); in nfs41_handle_some_state_revoked()
2427 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname); in nfs41_handle_some_state_revoked()
2430 static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp) in nfs41_handle_recallable_state_revoked() argument
2433 pnfs_destroy_all_layouts(clp); in nfs41_handle_recallable_state_revoked()
2434 nfs_test_expired_all_delegations(clp); in nfs41_handle_recallable_state_revoked()
2436 clp->cl_hostname); in nfs41_handle_recallable_state_revoked()
2439 static void nfs41_handle_backchannel_fault(struct nfs_client *clp) in nfs41_handle_backchannel_fault() argument
2441 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs41_handle_backchannel_fault()
2442 nfs4_schedule_state_manager(clp); in nfs41_handle_backchannel_fault()
2445 clp->cl_hostname); in nfs41_handle_backchannel_fault()
2448 static void nfs41_handle_cb_path_down(struct nfs_client *clp) in nfs41_handle_cb_path_down() argument
2451 &clp->cl_state) == 0) in nfs41_handle_cb_path_down()
2452 nfs4_schedule_state_manager(clp); in nfs41_handle_cb_path_down()
2455 void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags, in nfs41_handle_sequence_flag_errors() argument
2462 __func__, clp->cl_hostname, clp->cl_clientid, flags); in nfs41_handle_sequence_flag_errors()
2473 nfs41_handle_server_reboot(clp); in nfs41_handle_sequence_flag_errors()
2475 nfs41_handle_all_state_revoked(clp); in nfs41_handle_sequence_flag_errors()
2478 nfs41_handle_some_state_revoked(clp); in nfs41_handle_sequence_flag_errors()
2480 nfs4_schedule_lease_moved_recovery(clp); in nfs41_handle_sequence_flag_errors()
2482 nfs41_handle_recallable_state_revoked(clp); in nfs41_handle_sequence_flag_errors()
2485 nfs41_handle_backchannel_fault(clp); in nfs41_handle_sequence_flag_errors()
2488 nfs41_handle_cb_path_down(clp); in nfs41_handle_sequence_flag_errors()
2491 static int nfs4_reset_session(struct nfs_client *clp) in nfs4_reset_session() argument
2496 if (!nfs4_has_session(clp)) in nfs4_reset_session()
2498 status = nfs4_begin_drain_session(clp); in nfs4_reset_session()
2501 cred = nfs4_get_clid_cred(clp); in nfs4_reset_session()
2502 status = nfs4_proc_destroy_session(clp->cl_session, cred); in nfs4_reset_session()
2510 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_reset_session()
2515 status = nfs4_recovery_handle_error(clp, status); in nfs4_reset_session()
2519 memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN); in nfs4_reset_session()
2520 status = nfs4_proc_create_session(clp, cred); in nfs4_reset_session()
2523 __func__, status, clp->cl_hostname); in nfs4_reset_session()
2524 status = nfs4_handle_reclaim_lease_error(clp, status); in nfs4_reset_session()
2527 nfs41_finish_session_reset(clp); in nfs4_reset_session()
2529 __func__, clp->cl_hostname); in nfs4_reset_session()
2535 static int nfs4_bind_conn_to_session(struct nfs_client *clp) in nfs4_bind_conn_to_session() argument
2540 if (!nfs4_has_session(clp)) in nfs4_bind_conn_to_session()
2542 ret = nfs4_begin_drain_session(clp); in nfs4_bind_conn_to_session()
2545 cred = nfs4_get_clid_cred(clp); in nfs4_bind_conn_to_session()
2546 ret = nfs4_proc_bind_conn_to_session(clp, cred); in nfs4_bind_conn_to_session()
2548 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_bind_conn_to_session()
2552 __func__, clp->cl_hostname); in nfs4_bind_conn_to_session()
2556 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_bind_conn_to_session()
2559 return nfs4_recovery_handle_error(clp, ret); in nfs4_bind_conn_to_session()
2564 static void nfs4_layoutreturn_any_run(struct nfs_client *clp) in nfs4_layoutreturn_any_run() argument
2568 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_READ, &clp->cl_state)) in nfs4_layoutreturn_any_run()
2570 if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_RW, &clp->cl_state)) in nfs4_layoutreturn_any_run()
2574 pnfs_layout_return_unused_byclid(clp, iomode); in nfs4_layoutreturn_any_run()
2575 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state); in nfs4_layoutreturn_any_run()
2579 static int nfs4_reset_session(struct nfs_client *clp) { return 0; } in nfs4_reset_session() argument
2581 static int nfs4_bind_conn_to_session(struct nfs_client *clp) in nfs4_bind_conn_to_session() argument
2586 static void nfs4_layoutreturn_any_run(struct nfs_client *clp) in nfs4_layoutreturn_any_run() argument
2591 static void nfs4_state_manager(struct nfs_client *clp) in nfs4_state_manager() argument
2606 trace_nfs4_state_mgr(clp); in nfs4_state_manager()
2607 clear_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state); in nfs4_state_manager()
2608 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) { in nfs4_state_manager()
2610 status = nfs4_purge_lease(clp); in nfs4_state_manager()
2616 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { in nfs4_state_manager()
2619 status = nfs4_reclaim_lease(clp); in nfs4_state_manager()
2626 if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) { in nfs4_state_manager()
2628 status = nfs4_reset_session(clp); in nfs4_state_manager()
2629 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_state_manager()
2637 &clp->cl_state)) { in nfs4_state_manager()
2639 status = nfs4_bind_conn_to_session(clp); in nfs4_state_manager()
2645 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { in nfs4_state_manager()
2647 status = nfs4_check_lease(clp); in nfs4_state_manager()
2653 if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) { in nfs4_state_manager()
2655 status = nfs4_handle_migration(clp); in nfs4_state_manager()
2660 if (test_and_clear_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state)) { in nfs4_state_manager()
2662 status = nfs4_handle_lease_moved(clp); in nfs4_state_manager()
2668 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { in nfs4_state_manager()
2670 status = nfs4_do_reclaim(clp, in nfs4_state_manager()
2671 clp->cl_mvops->reboot_recovery_ops); in nfs4_state_manager()
2676 nfs4_state_end_reclaim_reboot(clp); in nfs4_state_manager()
2681 if (test_and_clear_bit(NFS4CLNT_DELEGATION_EXPIRED, &clp->cl_state)) { in nfs4_state_manager()
2683 nfs_reap_expired_delegations(clp); in nfs4_state_manager()
2688 if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { in nfs4_state_manager()
2690 status = nfs4_do_reclaim(clp, in nfs4_state_manager()
2691 clp->cl_mvops->nograce_recovery_ops); in nfs4_state_manager()
2696 clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); in nfs4_state_manager()
2700 nfs4_end_drain_session(clp); in nfs4_state_manager()
2701 nfs4_clear_state_manager_bit(clp); in nfs4_state_manager()
2703 if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) { in nfs4_state_manager()
2704 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { in nfs4_state_manager()
2705 nfs_client_return_marked_delegations(clp); in nfs4_state_manager()
2706 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state); in nfs4_state_manager()
2708 nfs4_layoutreturn_any_run(clp); in nfs4_state_manager()
2709 clear_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state); in nfs4_state_manager()
2714 } while (refcount_read(&clp->cl_count) > 1 && !signalled()); in nfs4_state_manager()
2720 trace_nfs4_state_mgr_failed(clp, section, status); in nfs4_state_manager()
2723 clp->cl_hostname, -status); in nfs4_state_manager()
2727 nfs4_end_drain_session(clp); in nfs4_state_manager()
2728 nfs4_clear_state_manager_bit(clp); in nfs4_state_manager()
2733 struct nfs_client *clp = ptr; in nfs4_run_state_manager() local
2734 struct rpc_clnt *cl = clp->cl_rpcclient; in nfs4_run_state_manager()
2741 set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); in nfs4_run_state_manager()
2742 nfs4_state_manager(clp); in nfs4_run_state_manager()
2744 wait_var_event_interruptible(&clp->cl_state, in nfs4_run_state_manager()
2746 &clp->cl_state)); in nfs4_run_state_manager()
2748 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state)) in nfs4_run_state_manager()
2752 clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state); in nfs4_run_state_manager()
2754 if (refcount_read(&clp->cl_count) > 1 && !signalled() && in nfs4_run_state_manager()
2755 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) && in nfs4_run_state_manager()
2756 !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state)) in nfs4_run_state_manager()
2759 nfs_put_client(clp); in nfs4_run_state_manager()