Lines Matching refs:clp
71 int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) in nfs4_init_clientid() argument
74 .clientid = clp->cl_clientid, in nfs4_init_clientid()
75 .confirm = clp->cl_confirm, in nfs4_init_clientid()
79 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs4_init_clientid()
81 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) in nfs4_init_clientid()
84 if (clp->cl_addr.ss_family == AF_INET6) in nfs4_init_clientid()
87 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); in nfs4_init_clientid()
90 clp->cl_clientid = clid.clientid; in nfs4_init_clientid()
91 clp->cl_confirm = clid.confirm; in nfs4_init_clientid()
92 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_init_clientid()
94 status = nfs4_proc_setclientid_confirm(clp, &clid, cred); in nfs4_init_clientid()
97 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_init_clientid()
98 nfs4_schedule_state_renewal(clp); in nfs4_init_clientid()
116 int nfs40_discover_server_trunking(struct nfs_client *clp, in nfs40_discover_server_trunking() argument
121 .clientid = clp->cl_clientid, in nfs40_discover_server_trunking()
122 .confirm = clp->cl_confirm, in nfs40_discover_server_trunking()
124 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs40_discover_server_trunking()
129 if (clp->cl_addr.ss_family == AF_INET6) in nfs40_discover_server_trunking()
132 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); in nfs40_discover_server_trunking()
135 clp->cl_clientid = clid.clientid; in nfs40_discover_server_trunking()
136 clp->cl_confirm = clid.confirm; in nfs40_discover_server_trunking()
138 status = nfs40_walk_client_list(clp, result, cred); in nfs40_discover_server_trunking()
148 struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp) in nfs4_get_machine_cred_locked() argument
152 if (clp->cl_machine_cred != NULL) in nfs4_get_machine_cred_locked()
153 cred = get_rpccred(clp->cl_machine_cred); in nfs4_get_machine_cred_locked()
157 static void nfs4_root_machine_cred(struct nfs_client *clp) in nfs4_root_machine_cred() argument
162 spin_lock(&clp->cl_lock); in nfs4_root_machine_cred()
163 cred = clp->cl_machine_cred; in nfs4_root_machine_cred()
164 clp->cl_machine_cred = new; in nfs4_root_machine_cred()
165 spin_unlock(&clp->cl_lock); in nfs4_root_machine_cred()
196 struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp) in nfs4_get_renew_cred_locked() argument
202 cred = nfs4_get_machine_cred_locked(clp); in nfs4_get_renew_cred_locked()
207 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_get_renew_cred_locked()
227 static void nfs4_end_drain_session(struct nfs_client *clp) in nfs4_end_drain_session() argument
229 struct nfs4_session *ses = clp->cl_session; in nfs4_end_drain_session()
231 if (clp->cl_slot_tbl) { in nfs4_end_drain_session()
232 nfs4_end_drain_slot_table(clp->cl_slot_tbl); in nfs4_end_drain_session()
255 static int nfs4_begin_drain_session(struct nfs_client *clp) in nfs4_begin_drain_session() argument
257 struct nfs4_session *ses = clp->cl_session; in nfs4_begin_drain_session()
260 if (clp->cl_slot_tbl) in nfs4_begin_drain_session()
261 return nfs4_drain_slot_tbl(clp->cl_slot_tbl); in nfs4_begin_drain_session()
273 static int nfs41_setup_state_renewal(struct nfs_client *clp) in nfs41_setup_state_renewal() argument
278 if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { in nfs41_setup_state_renewal()
279 nfs4_schedule_state_renewal(clp); in nfs41_setup_state_renewal()
283 status = nfs4_proc_get_lease_time(clp, &fsinfo); in nfs41_setup_state_renewal()
286 spin_lock(&clp->cl_lock); in nfs41_setup_state_renewal()
287 clp->cl_lease_time = fsinfo.lease_time * HZ; in nfs41_setup_state_renewal()
288 clp->cl_last_renewal = jiffies; in nfs41_setup_state_renewal()
289 spin_unlock(&clp->cl_lock); in nfs41_setup_state_renewal()
291 nfs4_schedule_state_renewal(clp); in nfs41_setup_state_renewal()
297 static void nfs41_finish_session_reset(struct nfs_client *clp) in nfs41_finish_session_reset() argument
299 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_finish_session_reset()
300 clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs41_finish_session_reset()
302 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs41_finish_session_reset()
303 nfs41_setup_state_renewal(clp); in nfs41_finish_session_reset()
306 int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) in nfs41_init_clientid() argument
310 if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) in nfs41_init_clientid()
312 nfs4_begin_drain_session(clp); in nfs41_init_clientid()
313 status = nfs4_proc_exchange_id(clp, cred); in nfs41_init_clientid()
316 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_init_clientid()
318 status = nfs4_proc_create_session(clp, cred); in nfs41_init_clientid()
321 nfs41_finish_session_reset(clp); in nfs41_init_clientid()
322 nfs_mark_client_ready(clp, NFS_CS_READY); in nfs41_init_clientid()
340 int nfs41_discover_server_trunking(struct nfs_client *clp, in nfs41_discover_server_trunking() argument
346 status = nfs4_proc_exchange_id(clp, cred); in nfs41_discover_server_trunking()
350 status = nfs41_walk_client_list(clp, result, cred); in nfs41_discover_server_trunking()
353 if (clp != *result) in nfs41_discover_server_trunking()
357 if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R) in nfs41_discover_server_trunking()
358 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs41_discover_server_trunking()
360 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs41_discover_server_trunking()
361 nfs4_schedule_state_manager(clp); in nfs41_discover_server_trunking()
362 status = nfs_wait_client_init_complete(clp); in nfs41_discover_server_trunking()
364 nfs_put_client(clp); in nfs41_discover_server_trunking()
376 struct rpc_cred *nfs4_get_clid_cred(struct nfs_client *clp) in nfs4_get_clid_cred() argument
380 spin_lock(&clp->cl_lock); in nfs4_get_clid_cred()
381 cred = nfs4_get_machine_cred_locked(clp); in nfs4_get_clid_cred()
382 spin_unlock(&clp->cl_lock); in nfs4_get_clid_cred()
504 struct nfs_client *clp = server->nfs_client; in nfs4_drop_state_owner() local
506 spin_lock(&clp->cl_lock); in nfs4_drop_state_owner()
511 spin_unlock(&clp->cl_lock); in nfs4_drop_state_owner()
524 struct nfs_client *clp = server->nfs_client; in nfs4_gc_state_owners() local
529 spin_lock(&clp->cl_lock); in nfs4_gc_state_owners()
531 time_min = (long)time_max - (long)clp->cl_lease_time; in nfs4_gc_state_owners()
539 spin_unlock(&clp->cl_lock); in nfs4_gc_state_owners()
558 struct nfs_client *clp = server->nfs_client; in nfs4_get_state_owner() local
561 spin_lock(&clp->cl_lock); in nfs4_get_state_owner()
563 spin_unlock(&clp->cl_lock); in nfs4_get_state_owner()
572 spin_lock(&clp->cl_lock); in nfs4_get_state_owner()
574 spin_unlock(&clp->cl_lock); in nfs4_get_state_owner()
598 struct nfs_client *clp = server->nfs_client; in nfs4_put_state_owner() local
600 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) in nfs4_put_state_owner()
605 spin_unlock(&clp->cl_lock); in nfs4_put_state_owner()
617 struct nfs_client *clp = server->nfs_client; in nfs4_purge_state_owners() local
621 spin_lock(&clp->cl_lock); in nfs4_purge_state_owners()
626 spin_unlock(&clp->cl_lock); in nfs4_purge_state_owners()
902 struct nfs_client *clp = server->nfs_client; in nfs4_put_lock_state() local
904 clp->cl_mvops->free_lock_state(server, lsp); in nfs4_put_lock_state()
1135 static void nfs4_clear_state_manager_bit(struct nfs_client *clp) in nfs4_clear_state_manager_bit() argument
1138 clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); in nfs4_clear_state_manager_bit()
1140 wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING); in nfs4_clear_state_manager_bit()
1141 rpc_wake_up(&clp->cl_rpcwaitq); in nfs4_clear_state_manager_bit()
1147 void nfs4_schedule_state_manager(struct nfs_client *clp) in nfs4_schedule_state_manager() argument
1152 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) in nfs4_schedule_state_manager()
1155 atomic_inc(&clp->cl_count); in nfs4_schedule_state_manager()
1162 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); in nfs4_schedule_state_manager()
1164 task = kthread_run(nfs4_run_state_manager, clp, "%s", buf); in nfs4_schedule_state_manager()
1168 nfs4_clear_state_manager_bit(clp); in nfs4_schedule_state_manager()
1169 nfs_put_client(clp); in nfs4_schedule_state_manager()
1177 void nfs4_schedule_lease_recovery(struct nfs_client *clp) in nfs4_schedule_lease_recovery() argument
1179 if (!clp) in nfs4_schedule_lease_recovery()
1181 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_schedule_lease_recovery()
1182 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_schedule_lease_recovery()
1184 clp->cl_hostname); in nfs4_schedule_lease_recovery()
1185 nfs4_schedule_state_manager(clp); in nfs4_schedule_lease_recovery()
1199 struct nfs_client *clp = server->nfs_client; in nfs4_schedule_migration_recovery() local
1203 clp->cl_hostname); in nfs4_schedule_migration_recovery()
1214 clp->cl_hostname); in nfs4_schedule_migration_recovery()
1218 set_bit(NFS4CLNT_MOVED, &clp->cl_state); in nfs4_schedule_migration_recovery()
1220 nfs4_schedule_state_manager(clp); in nfs4_schedule_migration_recovery()
1231 void nfs4_schedule_lease_moved_recovery(struct nfs_client *clp) in nfs4_schedule_lease_moved_recovery() argument
1234 __func__, clp->cl_clientid, clp->cl_hostname); in nfs4_schedule_lease_moved_recovery()
1236 set_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state); in nfs4_schedule_lease_moved_recovery()
1237 nfs4_schedule_state_manager(clp); in nfs4_schedule_lease_moved_recovery()
1241 int nfs4_wait_clnt_recover(struct nfs_client *clp) in nfs4_wait_clnt_recover() argument
1247 atomic_inc(&clp->cl_count); in nfs4_wait_clnt_recover()
1248 res = wait_on_bit_action(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING, in nfs4_wait_clnt_recover()
1252 if (clp->cl_cons_state < 0) in nfs4_wait_clnt_recover()
1253 res = clp->cl_cons_state; in nfs4_wait_clnt_recover()
1255 nfs_put_client(clp); in nfs4_wait_clnt_recover()
1259 int nfs4_client_recover_expired_lease(struct nfs_client *clp) in nfs4_client_recover_expired_lease() argument
1265 ret = nfs4_wait_clnt_recover(clp); in nfs4_client_recover_expired_lease()
1268 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && in nfs4_client_recover_expired_lease()
1269 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) in nfs4_client_recover_expired_lease()
1271 nfs4_schedule_state_manager(clp); in nfs4_client_recover_expired_lease()
1285 static void nfs40_handle_cb_pathdown(struct nfs_client *clp) in nfs40_handle_cb_pathdown() argument
1287 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs40_handle_cb_pathdown()
1288 nfs_expire_all_delegations(clp); in nfs40_handle_cb_pathdown()
1290 clp->cl_hostname); in nfs40_handle_cb_pathdown()
1293 void nfs4_schedule_path_down_recovery(struct nfs_client *clp) in nfs4_schedule_path_down_recovery() argument
1295 nfs40_handle_cb_pathdown(clp); in nfs4_schedule_path_down_recovery()
1296 nfs4_schedule_state_manager(clp); in nfs4_schedule_path_down_recovery()
1299 static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) in nfs4_state_mark_reclaim_reboot() argument
1309 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_state_mark_reclaim_reboot()
1313 int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state) in nfs4_state_mark_reclaim_nograce() argument
1318 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); in nfs4_state_mark_reclaim_nograce()
1324 struct nfs_client *clp = server->nfs_client; in nfs4_schedule_stateid_recovery() local
1328 nfs4_state_mark_reclaim_nograce(clp, state); in nfs4_schedule_stateid_recovery()
1330 clp->cl_hostname); in nfs4_schedule_stateid_recovery()
1331 nfs4_schedule_state_manager(clp); in nfs4_schedule_stateid_recovery()
1339 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; in nfs_inode_find_state_and_recover() local
1354 nfs4_state_mark_reclaim_nograce(clp, state); in nfs_inode_find_state_and_recover()
1359 nfs4_schedule_state_manager(clp); in nfs_inode_find_state_and_recover()
1552 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state)) in nfs4_reset_seqids() argument
1554 struct nfs_client *clp = server->nfs_client; in nfs4_reset_seqids() local
1559 spin_lock(&clp->cl_lock); in nfs4_reset_seqids()
1567 if (mark_reclaim(clp, state)) in nfs4_reset_seqids()
1572 spin_unlock(&clp->cl_lock); in nfs4_reset_seqids()
1575 static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp, in nfs4_state_mark_reclaim_helper() argument
1576 int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state)) in nfs4_state_mark_reclaim_helper() argument
1581 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) in nfs4_state_mark_reclaim_helper()
1586 static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) in nfs4_state_start_reclaim_reboot() argument
1589 nfs_delegation_mark_reclaim(clp); in nfs4_state_start_reclaim_reboot()
1590 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot); in nfs4_state_start_reclaim_reboot()
1593 static void nfs4_reclaim_complete(struct nfs_client *clp, in nfs4_reclaim_complete() argument
1599 (void)ops->reclaim_complete(clp, cred); in nfs4_reclaim_complete()
1604 struct nfs_client *clp = server->nfs_client; in nfs4_clear_reclaim_server() local
1609 spin_lock(&clp->cl_lock); in nfs4_clear_reclaim_server()
1619 nfs4_state_mark_reclaim_nograce(clp, state); in nfs4_clear_reclaim_server()
1623 spin_unlock(&clp->cl_lock); in nfs4_clear_reclaim_server()
1626 static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) in nfs4_state_clear_reclaim_reboot() argument
1630 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) in nfs4_state_clear_reclaim_reboot()
1634 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) in nfs4_state_clear_reclaim_reboot()
1638 nfs_delegation_reap_unclaimed(clp); in nfs4_state_clear_reclaim_reboot()
1642 static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) in nfs4_state_end_reclaim_reboot() argument
1647 if (!nfs4_state_clear_reclaim_reboot(clp)) in nfs4_state_end_reclaim_reboot()
1649 ops = clp->cl_mvops->reboot_recovery_ops; in nfs4_state_end_reclaim_reboot()
1650 cred = nfs4_get_clid_cred(clp); in nfs4_state_end_reclaim_reboot()
1651 nfs4_reclaim_complete(clp, ops, cred); in nfs4_state_end_reclaim_reboot()
1655 static void nfs_delegation_clear_all(struct nfs_client *clp) in nfs_delegation_clear_all() argument
1657 nfs_delegation_mark_reclaim(clp); in nfs_delegation_clear_all()
1658 nfs_delegation_reap_unclaimed(clp); in nfs_delegation_clear_all()
1661 static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp) in nfs4_state_start_reclaim_nograce() argument
1663 nfs_delegation_clear_all(clp); in nfs4_state_start_reclaim_nograce()
1664 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); in nfs4_state_start_reclaim_nograce()
1667 static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) in nfs4_recovery_handle_error() argument
1673 nfs40_handle_cb_pathdown(clp); in nfs4_recovery_handle_error()
1676 nfs4_state_end_reclaim_reboot(clp); in nfs4_recovery_handle_error()
1679 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_recovery_handle_error()
1680 nfs4_state_clear_reclaim_reboot(clp); in nfs4_recovery_handle_error()
1681 nfs4_state_start_reclaim_reboot(clp); in nfs4_recovery_handle_error()
1684 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_recovery_handle_error()
1685 nfs4_state_start_reclaim_nograce(clp); in nfs4_recovery_handle_error()
1693 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_recovery_handle_error()
1697 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_recovery_handle_error()
1701 __func__, error, clp->cl_hostname); in nfs4_recovery_handle_error()
1705 clp->cl_hostname); in nfs4_recovery_handle_error()
1709 static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) in nfs4_do_reclaim() argument
1718 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_do_reclaim()
1720 spin_lock(&clp->cl_lock); in nfs4_do_reclaim()
1730 spin_unlock(&clp->cl_lock); in nfs4_do_reclaim()
1737 status = nfs4_recovery_handle_error(clp, status); in nfs4_do_reclaim()
1744 spin_unlock(&clp->cl_lock); in nfs4_do_reclaim()
1750 static int nfs4_check_lease(struct nfs_client *clp) in nfs4_check_lease() argument
1754 clp->cl_mvops->state_renewal_ops; in nfs4_check_lease()
1758 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_check_lease()
1760 spin_lock(&clp->cl_lock); in nfs4_check_lease()
1761 cred = ops->get_state_renewal_cred_locked(clp); in nfs4_check_lease()
1762 spin_unlock(&clp->cl_lock); in nfs4_check_lease()
1764 cred = nfs4_get_clid_cred(clp); in nfs4_check_lease()
1769 status = ops->renew_lease(clp, cred); in nfs4_check_lease()
1772 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_check_lease()
1776 return nfs4_recovery_handle_error(clp, status); in nfs4_check_lease()
1782 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) in nfs4_handle_reclaim_lease_error() argument
1786 if (test_and_set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) in nfs4_handle_reclaim_lease_error()
1790 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
1793 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
1794 nfs4_state_start_reclaim_reboot(clp); in nfs4_handle_reclaim_lease_error()
1798 clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
1799 nfs_mark_client_ready(clp, -EPERM); in nfs4_handle_reclaim_lease_error()
1800 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
1810 if (clp->cl_cons_state == NFS_CS_SESSION_INITING) in nfs4_handle_reclaim_lease_error()
1811 nfs_mark_client_ready(clp, -EPROTONOSUPPORT); in nfs4_handle_reclaim_lease_error()
1813 __func__, -EPROTONOSUPPORT, clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
1819 status, clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
1822 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_handle_reclaim_lease_error()
1824 clp->cl_hostname); in nfs4_handle_reclaim_lease_error()
1828 static int nfs4_establish_lease(struct nfs_client *clp) in nfs4_establish_lease() argument
1832 clp->cl_mvops->reboot_recovery_ops; in nfs4_establish_lease()
1835 cred = nfs4_get_clid_cred(clp); in nfs4_establish_lease()
1838 status = ops->establish_clid(clp, cred); in nfs4_establish_lease()
1842 pnfs_destroy_all_layouts(clp); in nfs4_establish_lease()
1850 static int nfs4_reclaim_lease(struct nfs_client *clp) in nfs4_reclaim_lease() argument
1854 status = nfs4_establish_lease(clp); in nfs4_reclaim_lease()
1856 return nfs4_handle_reclaim_lease_error(clp, status); in nfs4_reclaim_lease()
1857 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state)) in nfs4_reclaim_lease()
1858 nfs4_state_start_reclaim_nograce(clp); in nfs4_reclaim_lease()
1859 if (!test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) in nfs4_reclaim_lease()
1860 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); in nfs4_reclaim_lease()
1861 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs4_reclaim_lease()
1862 clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_reclaim_lease()
1866 static int nfs4_purge_lease(struct nfs_client *clp) in nfs4_purge_lease() argument
1870 status = nfs4_establish_lease(clp); in nfs4_purge_lease()
1872 return nfs4_handle_reclaim_lease_error(clp, status); in nfs4_purge_lease()
1873 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs4_purge_lease()
1874 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); in nfs4_purge_lease()
1875 nfs4_state_start_reclaim_nograce(clp); in nfs4_purge_lease()
1888 struct nfs_client *clp = server->nfs_client; in nfs4_try_migration() local
1897 clp->cl_hostname); in nfs4_try_migration()
1922 nfs4_begin_drain_session(clp); in nfs4_try_migration()
1940 clp->cl_hostname); in nfs4_try_migration()
1949 static int nfs4_handle_migration(struct nfs_client *clp) in nfs4_handle_migration() argument
1952 clp->cl_mvops->state_renewal_ops; in nfs4_handle_migration()
1957 clp->cl_hostname); in nfs4_handle_migration()
1959 spin_lock(&clp->cl_lock); in nfs4_handle_migration()
1960 cred = ops->get_state_renewal_cred_locked(clp); in nfs4_handle_migration()
1961 spin_unlock(&clp->cl_lock); in nfs4_handle_migration()
1965 clp->cl_mig_gen++; in nfs4_handle_migration()
1968 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_handle_migration()
1971 if (server->mig_gen == clp->cl_mig_gen) in nfs4_handle_migration()
1973 server->mig_gen = clp->cl_mig_gen; in nfs4_handle_migration()
1997 static int nfs4_handle_lease_moved(struct nfs_client *clp) in nfs4_handle_lease_moved() argument
2000 clp->cl_mvops->state_renewal_ops; in nfs4_handle_lease_moved()
2005 clp->cl_hostname); in nfs4_handle_lease_moved()
2007 spin_lock(&clp->cl_lock); in nfs4_handle_lease_moved()
2008 cred = ops->get_state_renewal_cred_locked(clp); in nfs4_handle_lease_moved()
2009 spin_unlock(&clp->cl_lock); in nfs4_handle_lease_moved()
2013 clp->cl_mig_gen++; in nfs4_handle_lease_moved()
2016 list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { in nfs4_handle_lease_moved()
2020 if (server->mig_gen == clp->cl_mig_gen) in nfs4_handle_lease_moved()
2022 server->mig_gen = clp->cl_mig_gen; in nfs4_handle_lease_moved()
2054 int nfs4_discover_server_trunking(struct nfs_client *clp, in nfs4_discover_server_trunking() argument
2058 clp->cl_mvops->reboot_recovery_ops; in nfs4_discover_server_trunking()
2063 dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname); in nfs4_discover_server_trunking()
2065 clnt = clp->cl_rpcclient; in nfs4_discover_server_trunking()
2071 cred = nfs4_get_clid_cred(clp); in nfs4_discover_server_trunking()
2075 status = ops->detect_trunking(clp, result, cred); in nfs4_discover_server_trunking()
2092 nfs4_root_machine_cred(clp); in nfs4_discover_server_trunking()
2113 clnt = xchg(&clp->cl_rpcclient, clnt); in nfs4_discover_server_trunking()
2115 clnt = clp->cl_rpcclient; in nfs4_discover_server_trunking()
2142 struct nfs_client *clp = session->clp; in nfs4_schedule_session_recovery() local
2146 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_schedule_session_recovery()
2149 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_schedule_session_recovery()
2151 nfs4_schedule_lease_recovery(clp); in nfs4_schedule_session_recovery()
2155 static void nfs41_ping_server(struct nfs_client *clp) in nfs41_ping_server() argument
2158 set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); in nfs41_ping_server()
2159 nfs4_schedule_state_manager(clp); in nfs41_ping_server()
2162 void nfs41_server_notify_target_slotid_update(struct nfs_client *clp) in nfs41_server_notify_target_slotid_update() argument
2164 nfs41_ping_server(clp); in nfs41_server_notify_target_slotid_update()
2167 void nfs41_server_notify_highest_slotid_update(struct nfs_client *clp) in nfs41_server_notify_highest_slotid_update() argument
2169 nfs41_ping_server(clp); in nfs41_server_notify_highest_slotid_update()
2172 static void nfs4_reset_all_state(struct nfs_client *clp) in nfs4_reset_all_state() argument
2174 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { in nfs4_reset_all_state()
2175 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); in nfs4_reset_all_state()
2176 clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); in nfs4_reset_all_state()
2177 nfs4_state_start_reclaim_nograce(clp); in nfs4_reset_all_state()
2179 __func__, clp->cl_hostname); in nfs4_reset_all_state()
2180 nfs4_schedule_state_manager(clp); in nfs4_reset_all_state()
2184 static void nfs41_handle_server_reboot(struct nfs_client *clp) in nfs41_handle_server_reboot() argument
2186 if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { in nfs41_handle_server_reboot()
2187 nfs4_state_start_reclaim_reboot(clp); in nfs41_handle_server_reboot()
2189 clp->cl_hostname); in nfs41_handle_server_reboot()
2190 nfs4_schedule_state_manager(clp); in nfs41_handle_server_reboot()
2194 static void nfs41_handle_state_revoked(struct nfs_client *clp) in nfs41_handle_state_revoked() argument
2196 nfs4_reset_all_state(clp); in nfs41_handle_state_revoked()
2197 dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname); in nfs41_handle_state_revoked()
2200 static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp) in nfs41_handle_recallable_state_revoked() argument
2203 nfs_expire_all_delegations(clp); in nfs41_handle_recallable_state_revoked()
2205 clp->cl_hostname); in nfs41_handle_recallable_state_revoked()
2208 static void nfs41_handle_backchannel_fault(struct nfs_client *clp) in nfs41_handle_backchannel_fault() argument
2210 nfs_expire_all_delegations(clp); in nfs41_handle_backchannel_fault()
2211 if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0) in nfs41_handle_backchannel_fault()
2212 nfs4_schedule_state_manager(clp); in nfs41_handle_backchannel_fault()
2214 clp->cl_hostname); in nfs41_handle_backchannel_fault()
2217 static void nfs41_handle_cb_path_down(struct nfs_client *clp) in nfs41_handle_cb_path_down() argument
2220 &clp->cl_state) == 0) in nfs41_handle_cb_path_down()
2221 nfs4_schedule_state_manager(clp); in nfs41_handle_cb_path_down()
2224 void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) in nfs41_handle_sequence_flag_errors() argument
2230 __func__, clp->cl_hostname, clp->cl_clientid, flags); in nfs41_handle_sequence_flag_errors()
2233 nfs41_handle_server_reboot(clp); in nfs41_handle_sequence_flag_errors()
2237 nfs41_handle_state_revoked(clp); in nfs41_handle_sequence_flag_errors()
2239 nfs4_schedule_lease_moved_recovery(clp); in nfs41_handle_sequence_flag_errors()
2241 nfs41_handle_recallable_state_revoked(clp); in nfs41_handle_sequence_flag_errors()
2243 nfs41_handle_backchannel_fault(clp); in nfs41_handle_sequence_flag_errors()
2246 nfs41_handle_cb_path_down(clp); in nfs41_handle_sequence_flag_errors()
2249 static int nfs4_reset_session(struct nfs_client *clp) in nfs4_reset_session() argument
2254 if (!nfs4_has_session(clp)) in nfs4_reset_session()
2256 nfs4_begin_drain_session(clp); in nfs4_reset_session()
2257 cred = nfs4_get_clid_cred(clp); in nfs4_reset_session()
2258 status = nfs4_proc_destroy_session(clp->cl_session, cred); in nfs4_reset_session()
2266 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); in nfs4_reset_session()
2271 status = nfs4_recovery_handle_error(clp, status); in nfs4_reset_session()
2275 memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN); in nfs4_reset_session()
2276 status = nfs4_proc_create_session(clp, cred); in nfs4_reset_session()
2279 __func__, status, clp->cl_hostname); in nfs4_reset_session()
2280 status = nfs4_handle_reclaim_lease_error(clp, status); in nfs4_reset_session()
2283 nfs41_finish_session_reset(clp); in nfs4_reset_session()
2285 __func__, clp->cl_hostname); in nfs4_reset_session()
2292 static int nfs4_bind_conn_to_session(struct nfs_client *clp) in nfs4_bind_conn_to_session() argument
2297 if (!nfs4_has_session(clp)) in nfs4_bind_conn_to_session()
2299 nfs4_begin_drain_session(clp); in nfs4_bind_conn_to_session()
2300 cred = nfs4_get_clid_cred(clp); in nfs4_bind_conn_to_session()
2301 ret = nfs4_proc_bind_conn_to_session(clp, cred); in nfs4_bind_conn_to_session()
2304 clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_bind_conn_to_session()
2308 __func__, clp->cl_hostname); in nfs4_bind_conn_to_session()
2312 set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); in nfs4_bind_conn_to_session()
2315 return nfs4_recovery_handle_error(clp, ret); in nfs4_bind_conn_to_session()
2320 static int nfs4_reset_session(struct nfs_client *clp) { return 0; } in nfs4_reset_session() argument
2322 static int nfs4_bind_conn_to_session(struct nfs_client *clp) in nfs4_bind_conn_to_session() argument
2328 static void nfs4_state_manager(struct nfs_client *clp) in nfs4_state_manager() argument
2335 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) { in nfs4_state_manager()
2337 status = nfs4_purge_lease(clp); in nfs4_state_manager()
2343 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { in nfs4_state_manager()
2346 status = nfs4_reclaim_lease(clp); in nfs4_state_manager()
2353 if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) { in nfs4_state_manager()
2355 status = nfs4_reset_session(clp); in nfs4_state_manager()
2356 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) in nfs4_state_manager()
2364 &clp->cl_state)) { in nfs4_state_manager()
2366 status = nfs4_bind_conn_to_session(clp); in nfs4_state_manager()
2372 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { in nfs4_state_manager()
2374 status = nfs4_check_lease(clp); in nfs4_state_manager()
2380 if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) { in nfs4_state_manager()
2382 status = nfs4_handle_migration(clp); in nfs4_state_manager()
2387 if (test_and_clear_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state)) { in nfs4_state_manager()
2389 status = nfs4_handle_lease_moved(clp); in nfs4_state_manager()
2395 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { in nfs4_state_manager()
2397 status = nfs4_do_reclaim(clp, in nfs4_state_manager()
2398 clp->cl_mvops->reboot_recovery_ops); in nfs4_state_manager()
2403 nfs4_state_end_reclaim_reboot(clp); in nfs4_state_manager()
2407 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { in nfs4_state_manager()
2409 status = nfs4_do_reclaim(clp, in nfs4_state_manager()
2410 clp->cl_mvops->nograce_recovery_ops); in nfs4_state_manager()
2417 nfs4_end_drain_session(clp); in nfs4_state_manager()
2418 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { in nfs4_state_manager()
2419 nfs_client_return_marked_delegations(clp); in nfs4_state_manager()
2423 nfs4_clear_state_manager_bit(clp); in nfs4_state_manager()
2425 if (clp->cl_state == 0) in nfs4_state_manager()
2427 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) in nfs4_state_manager()
2429 } while (atomic_read(&clp->cl_count) > 1); in nfs4_state_manager()
2436 clp->cl_hostname, -status); in nfs4_state_manager()
2438 nfs4_end_drain_session(clp); in nfs4_state_manager()
2439 nfs4_clear_state_manager_bit(clp); in nfs4_state_manager()
2444 struct nfs_client *clp = ptr; in nfs4_run_state_manager() local
2447 nfs4_state_manager(clp); in nfs4_run_state_manager()
2448 nfs_put_client(clp); in nfs4_run_state_manager()