Lines Matching refs:clp
141 static bool is_client_expired(struct nfs4_client *clp) in is_client_expired() argument
143 return clp->cl_time == 0; in is_client_expired()
146 static __be32 get_client_locked(struct nfs4_client *clp) in get_client_locked() argument
148 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in get_client_locked()
152 if (is_client_expired(clp)) in get_client_locked()
154 atomic_inc(&clp->cl_rpc_users); in get_client_locked()
160 renew_client_locked(struct nfs4_client *clp) in renew_client_locked() argument
162 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in renew_client_locked()
164 if (is_client_expired(clp)) { in renew_client_locked()
168 clp->cl_clientid.cl_boot, in renew_client_locked()
169 clp->cl_clientid.cl_id); in renew_client_locked()
173 list_move_tail(&clp->cl_lru, &nn->client_lru); in renew_client_locked()
174 clp->cl_time = ktime_get_boottime_seconds(); in renew_client_locked()
177 static void put_client_renew_locked(struct nfs4_client *clp) in put_client_renew_locked() argument
179 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in put_client_renew_locked()
183 if (!atomic_dec_and_test(&clp->cl_rpc_users)) in put_client_renew_locked()
185 if (!is_client_expired(clp)) in put_client_renew_locked()
186 renew_client_locked(clp); in put_client_renew_locked()
191 static void put_client_renew(struct nfs4_client *clp) in put_client_renew() argument
193 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in put_client_renew()
195 if (!atomic_dec_and_lock(&clp->cl_rpc_users, &nn->client_lock)) in put_client_renew()
197 if (!is_client_expired(clp)) in put_client_renew()
198 renew_client_locked(clp); in put_client_renew()
219 struct nfs4_client *clp = ses->se_client; in nfsd4_put_session_locked() local
220 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in nfsd4_put_session_locked()
226 put_client_renew_locked(clp); in nfsd4_put_session_locked()
231 struct nfs4_client *clp = ses->se_client; in nfsd4_put_session() local
232 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in nfsd4_put_session()
293 struct nfs4_client *clp = lo->lo_owner.so_client; in remove_blocked_locks() local
294 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in remove_blocked_locks()
492 struct nfs4_client *clp) in find_openstateowner_str_locked() argument
496 lockdep_assert_held(&clp->cl_lock); in find_openstateowner_str_locked()
498 list_for_each_entry(so, &clp->cl_ownerstr_hashtbl[hashval], in find_openstateowner_str_locked()
510 struct nfs4_client *clp) in find_openstateowner_str() argument
514 spin_lock(&clp->cl_lock); in find_openstateowner_str()
515 oo = find_openstateowner_str_locked(hashval, open, clp); in find_openstateowner_str()
516 spin_unlock(&clp->cl_lock); in find_openstateowner_str()
759 alloc_clnt_odstate(struct nfs4_client *clp) in alloc_clnt_odstate() argument
765 co->co_client = clp; in alloc_clnt_odstate()
951 static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) in nfs4_alloc_open_stateid() argument
955 stid = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_ol_stateid); in nfs4_alloc_open_stateid()
1045 alloc_init_deleg(struct nfs4_client *clp, struct nfs4_file *fp, in alloc_init_deleg() argument
1058 dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab, nfs4_free_deleg)); in alloc_init_deleg()
1089 struct nfs4_client *clp = s->sc_client; in nfs4_put_stid() local
1091 might_lock(&clp->cl_lock); in nfs4_put_stid()
1093 if (!refcount_dec_and_lock(&s->sc_count, &clp->cl_lock)) { in nfs4_put_stid()
1097 idr_remove(&clp->cl_stateids, s->sc_stateid.si_opaque.so_id); in nfs4_put_stid()
1098 nfs4_free_cpntf_statelist(clp->net, s); in nfs4_put_stid()
1099 spin_unlock(&clp->cl_lock); in nfs4_put_stid()
1163 nfs4_delegation_exists(struct nfs4_client *clp, struct nfs4_file *fp) in nfs4_delegation_exists() argument
1173 if (clp == searchclp) { in nfs4_delegation_exists()
1196 struct nfs4_client *clp = dp->dl_stid.sc_client; in hash_delegation_locked() local
1201 if (nfs4_delegation_exists(clp, fp)) in hash_delegation_locked()
1206 list_add(&dp->dl_perclnt, &clp->cl_delegations); in hash_delegation_locked()
1249 struct nfs4_client *clp = dp->dl_stid.sc_client; in revoke_delegation() local
1253 if (clp->cl_minorversion) { in revoke_delegation()
1256 spin_lock(&clp->cl_lock); in revoke_delegation()
1257 list_add(&dp->dl_recall_lru, &clp->cl_revoked); in revoke_delegation()
1258 spin_unlock(&clp->cl_lock); in revoke_delegation()
1336 struct nfs4_client *clp = sop->so_client; in nfs4_put_stateowner() local
1338 might_lock(&clp->cl_lock); in nfs4_put_stateowner()
1340 if (!atomic_dec_and_lock(&sop->so_count, &clp->cl_lock)) in nfs4_put_stateowner()
1343 spin_unlock(&clp->cl_lock); in nfs4_put_stateowner()
1404 struct nfs4_client *clp = s->sc_client; in put_ol_stateid_locked() local
1406 lockdep_assert_held(&clp->cl_lock); in put_ol_stateid_locked()
1415 idr_remove(&clp->cl_stateids, s->sc_stateid.si_opaque.so_id); in put_ol_stateid_locked()
1432 struct nfs4_client *clp = stp->st_stid.sc_client; in release_lock_stateid() local
1435 spin_lock(&clp->cl_lock); in release_lock_stateid()
1437 spin_unlock(&clp->cl_lock); in release_lock_stateid()
1444 struct nfs4_client *clp = lo->lo_owner.so_client; in unhash_lockowner_locked() local
1446 lockdep_assert_held(&clp->cl_lock); in unhash_lockowner_locked()
1513 struct nfs4_client *clp = oo->oo_owner.so_client; in unhash_openowner_locked() local
1515 lockdep_assert_held(&clp->cl_lock); in unhash_openowner_locked()
1541 struct nfs4_client *clp = oo->oo_owner.so_client; in release_openowner() local
1546 spin_lock(&clp->cl_lock); in release_openowner()
1554 spin_unlock(&clp->cl_lock); in release_openowner()
1608 struct nfs4_client *clp = ses->se_client; in gen_sessionid() local
1612 sid->clientid = clp->cl_clientid; in gen_sessionid()
1752 struct nfs4_client *clp = c->cn_session->se_client; in nfsd4_conn_lost() local
1754 trace_nfsd_cb_lost(clp); in nfsd4_conn_lost()
1756 spin_lock(&clp->cl_lock); in nfsd4_conn_lost()
1761 nfsd4_probe_callback(clp); in nfsd4_conn_lost()
1762 spin_unlock(&clp->cl_lock); in nfsd4_conn_lost()
1787 struct nfs4_client *clp = ses->se_client; in nfsd4_hash_conn() local
1789 spin_lock(&clp->cl_lock); in nfsd4_hash_conn()
1791 spin_unlock(&clp->cl_lock); in nfsd4_hash_conn()
1825 struct nfs4_client *clp = s->se_client; in nfsd4_del_conns() local
1828 spin_lock(&clp->cl_lock); in nfsd4_del_conns()
1832 spin_unlock(&clp->cl_lock); in nfsd4_del_conns()
1837 spin_lock(&clp->cl_lock); in nfsd4_del_conns()
1839 spin_unlock(&clp->cl_lock); in nfsd4_del_conns()
1855 static void init_session(struct svc_rqst *rqstp, struct nfsd4_session *new, struct nfs4_client *clp… in init_session() argument
1860 new->se_client = clp; in init_session()
1872 spin_lock(&clp->cl_lock); in init_session()
1873 list_add(&new->se_perclnt, &clp->cl_sessions); in init_session()
1874 spin_unlock(&clp->cl_lock); in init_session()
1885 rpc_copy_addr((struct sockaddr *)&clp->cl_cb_conn.cb_addr, sa); in init_session()
1886 clp->cl_cb_conn.cb_addrlen = svc_addr_len(sa); in init_session()
1936 struct nfs4_client *clp = ses->se_client; in unhash_session() local
1937 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in unhash_session()
1969 struct nfs4_client *clp; in alloc_client() local
1972 clp = kmem_cache_zalloc(client_slab, GFP_KERNEL); in alloc_client()
1973 if (clp == NULL) in alloc_client()
1975 xdr_netobj_dup(&clp->cl_name, &name, GFP_KERNEL); in alloc_client()
1976 if (clp->cl_name.data == NULL) in alloc_client()
1978 clp->cl_ownerstr_hashtbl = kmalloc_array(OWNER_HASH_SIZE, in alloc_client()
1981 if (!clp->cl_ownerstr_hashtbl) in alloc_client()
1984 INIT_LIST_HEAD(&clp->cl_ownerstr_hashtbl[i]); in alloc_client()
1985 INIT_LIST_HEAD(&clp->cl_sessions); in alloc_client()
1986 idr_init(&clp->cl_stateids); in alloc_client()
1987 atomic_set(&clp->cl_rpc_users, 0); in alloc_client()
1988 clp->cl_cb_state = NFSD4_CB_UNKNOWN; in alloc_client()
1989 INIT_LIST_HEAD(&clp->cl_idhash); in alloc_client()
1990 INIT_LIST_HEAD(&clp->cl_openowners); in alloc_client()
1991 INIT_LIST_HEAD(&clp->cl_delegations); in alloc_client()
1992 INIT_LIST_HEAD(&clp->cl_lru); in alloc_client()
1993 INIT_LIST_HEAD(&clp->cl_revoked); in alloc_client()
1995 INIT_LIST_HEAD(&clp->cl_lo_states); in alloc_client()
1997 INIT_LIST_HEAD(&clp->async_copies); in alloc_client()
1998 spin_lock_init(&clp->async_lock); in alloc_client()
1999 spin_lock_init(&clp->cl_lock); in alloc_client()
2000 rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); in alloc_client()
2001 return clp; in alloc_client()
2003 kfree(clp->cl_name.data); in alloc_client()
2005 kmem_cache_free(client_slab, clp); in alloc_client()
2012 struct nfs4_client *clp = container_of(c, struct nfs4_client, cl_nfsdfs); in __free_client() local
2014 free_svc_cred(&clp->cl_cred); in __free_client()
2015 kfree(clp->cl_ownerstr_hashtbl); in __free_client()
2016 kfree(clp->cl_name.data); in __free_client()
2017 kfree(clp->cl_nii_domain.data); in __free_client()
2018 kfree(clp->cl_nii_name.data); in __free_client()
2019 idr_destroy(&clp->cl_stateids); in __free_client()
2020 kmem_cache_free(client_slab, clp); in __free_client()
2023 static void drop_client(struct nfs4_client *clp) in drop_client() argument
2025 kref_put(&clp->cl_nfsdfs.cl_ref, __free_client); in drop_client()
2029 free_client(struct nfs4_client *clp) in free_client() argument
2031 while (!list_empty(&clp->cl_sessions)) { in free_client()
2033 ses = list_entry(clp->cl_sessions.next, struct nfsd4_session, in free_client()
2039 rpc_destroy_wait_queue(&clp->cl_cb_waitq); in free_client()
2040 if (clp->cl_nfsd_dentry) { in free_client()
2041 nfsd_client_rmdir(clp->cl_nfsd_dentry); in free_client()
2042 clp->cl_nfsd_dentry = NULL; in free_client()
2045 drop_client(clp); in free_client()
2050 unhash_client_locked(struct nfs4_client *clp) in unhash_client_locked() argument
2052 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in unhash_client_locked()
2058 clp->cl_time = 0; in unhash_client_locked()
2060 if (!list_empty(&clp->cl_idhash)) { in unhash_client_locked()
2061 list_del_init(&clp->cl_idhash); in unhash_client_locked()
2062 if (test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) in unhash_client_locked()
2063 rb_erase(&clp->cl_namenode, &nn->conf_name_tree); in unhash_client_locked()
2065 rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); in unhash_client_locked()
2067 list_del_init(&clp->cl_lru); in unhash_client_locked()
2068 spin_lock(&clp->cl_lock); in unhash_client_locked()
2069 list_for_each_entry(ses, &clp->cl_sessions, se_perclnt) in unhash_client_locked()
2071 spin_unlock(&clp->cl_lock); in unhash_client_locked()
2075 unhash_client(struct nfs4_client *clp) in unhash_client() argument
2077 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in unhash_client()
2080 unhash_client_locked(clp); in unhash_client()
2084 static __be32 mark_client_expired_locked(struct nfs4_client *clp) in mark_client_expired_locked() argument
2086 if (atomic_read(&clp->cl_rpc_users)) in mark_client_expired_locked()
2088 unhash_client_locked(clp); in mark_client_expired_locked()
2093 __destroy_client(struct nfs4_client *clp) in __destroy_client() argument
2102 while (!list_empty(&clp->cl_delegations)) { in __destroy_client()
2103 dp = list_entry(clp->cl_delegations.next, struct nfs4_delegation, dl_perclnt); in __destroy_client()
2113 while (!list_empty(&clp->cl_revoked)) { in __destroy_client()
2114 dp = list_entry(clp->cl_revoked.next, struct nfs4_delegation, dl_recall_lru); in __destroy_client()
2118 while (!list_empty(&clp->cl_openowners)) { in __destroy_client()
2119 oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient); in __destroy_client()
2126 list_for_each_entry_safe(so, tmp, &clp->cl_ownerstr_hashtbl[i], in __destroy_client()
2133 nfsd4_return_all_client_layouts(clp); in __destroy_client()
2134 nfsd4_shutdown_copy(clp); in __destroy_client()
2135 nfsd4_shutdown_callback(clp); in __destroy_client()
2136 if (clp->cl_cb_conn.cb_xprt) in __destroy_client()
2137 svc_xprt_put(clp->cl_cb_conn.cb_xprt); in __destroy_client()
2138 free_client(clp); in __destroy_client()
2143 destroy_client(struct nfs4_client *clp) in destroy_client() argument
2145 unhash_client(clp); in destroy_client()
2146 __destroy_client(clp); in destroy_client()
2149 static void inc_reclaim_complete(struct nfs4_client *clp) in inc_reclaim_complete() argument
2151 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in inc_reclaim_complete()
2155 if (!nfsd4_find_reclaim_client(clp->cl_name, nn)) in inc_reclaim_complete()
2160 clp->net->ns.inum); in inc_reclaim_complete()
2165 static void expire_client(struct nfs4_client *clp) in expire_client() argument
2167 unhash_client(clp); in expire_client()
2168 nfsd4_client_record_remove(clp); in expire_client()
2169 __destroy_client(clp); in expire_client()
2302 static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn) in gen_confirm() argument
2312 memcpy(clp->cl_confirm.data, verf, sizeof(clp->cl_confirm.data)); in gen_confirm()
2315 static void gen_clid(struct nfs4_client *clp, struct nfsd_net *nn) in gen_clid() argument
2317 clp->cl_clientid.cl_boot = (u32)nn->boot_time; in gen_clid()
2318 clp->cl_clientid.cl_id = nn->clientid_counter++; in gen_clid()
2319 gen_confirm(clp, nn); in gen_clid()
2384 struct nfs4_client *clp; in client_info_show() local
2387 clp = get_nfsdfs_clp(inode); in client_info_show()
2388 if (!clp) in client_info_show()
2390 memcpy(&clid, &clp->cl_clientid, sizeof(clid)); in client_info_show()
2392 seq_printf(m, "address: \"%pISpc\"\n", (struct sockaddr *)&clp->cl_addr); in client_info_show()
2393 if (test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) in client_info_show()
2398 seq_quote_mem(m, clp->cl_name.data, clp->cl_name.len); in client_info_show()
2399 seq_printf(m, "\nminor version: %d\n", clp->cl_minorversion); in client_info_show()
2400 if (clp->cl_nii_domain.data) { in client_info_show()
2402 seq_quote_mem(m, clp->cl_nii_domain.data, in client_info_show()
2403 clp->cl_nii_domain.len); in client_info_show()
2405 seq_quote_mem(m, clp->cl_nii_name.data, clp->cl_nii_name.len); in client_info_show()
2407 clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec); in client_info_show()
2409 seq_printf(m, "callback state: %s\n", cb_state2str(clp->cl_cb_state)); in client_info_show()
2410 seq_printf(m, "callback address: %pISpc\n", &clp->cl_cb_conn.cb_addr); in client_info_show()
2411 drop_client(clp); in client_info_show()
2429 __acquires(&clp->cl_lock) in states_start()
2431 struct nfs4_client *clp = s->private; in states_start() local
2435 spin_lock(&clp->cl_lock); in states_start()
2436 ret = idr_get_next_ul(&clp->cl_stateids, &id); in states_start()
2443 struct nfs4_client *clp = s->private; in states_next() local
2449 ret = idr_get_next_ul(&clp->cl_stateids, &id); in states_next()
2455 __releases(&clp->cl_lock) in states_stop()
2457 struct nfs4_client *clp = s->private; in states_stop() local
2459 spin_unlock(&clp->cl_lock); in states_stop()
2650 struct nfs4_client *clp; in client_states_open() local
2653 clp = get_nfsdfs_clp(inode); in client_states_open()
2654 if (!clp) in client_states_open()
2661 s->private = clp; in client_states_open()
2668 struct nfs4_client *clp = m->private; in client_opens_release() local
2671 drop_client(clp); in client_opens_release()
2688 static void force_expire_client(struct nfs4_client *clp) in force_expire_client() argument
2690 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in force_expire_client()
2693 trace_nfsd_clid_admin_expired(&clp->cl_clientid); in force_expire_client()
2696 clp->cl_time = 0; in force_expire_client()
2699 wait_event(expiry_wq, atomic_read(&clp->cl_rpc_users) == 0); in force_expire_client()
2701 already_expired = list_empty(&clp->cl_lru); in force_expire_client()
2703 unhash_client_locked(clp); in force_expire_client()
2707 expire_client(clp); in force_expire_client()
2709 wait_event(expiry_wq, clp->cl_nfsd_dentry == NULL); in force_expire_client()
2716 struct nfs4_client *clp; in client_ctl_write() local
2723 clp = get_nfsdfs_clp(file_inode(file)); in client_ctl_write()
2724 if (!clp) in client_ctl_write()
2726 force_expire_client(clp); in client_ctl_write()
2727 drop_client(clp); in client_ctl_write()
2746 struct nfs4_client *clp; in create_client() local
2753 clp = alloc_client(name); in create_client()
2754 if (clp == NULL) in create_client()
2757 ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred); in create_client()
2759 free_client(clp); in create_client()
2762 gen_clid(clp, nn); in create_client()
2763 kref_init(&clp->cl_nfsdfs.cl_ref); in create_client()
2764 nfsd4_init_cb(&clp->cl_cb_null, clp, NULL, NFSPROC4_CLNT_CB_NULL); in create_client()
2765 clp->cl_time = ktime_get_boottime_seconds(); in create_client()
2766 clear_bit(0, &clp->cl_cb_slot_busy); in create_client()
2767 copy_verf(clp, verf); in create_client()
2768 memcpy(&clp->cl_addr, sa, sizeof(struct sockaddr_storage)); in create_client()
2769 clp->cl_cb_session = NULL; in create_client()
2770 clp->net = net; in create_client()
2771 clp->cl_nfsd_dentry = nfsd_client_mkdir( in create_client()
2772 nn, &clp->cl_nfsdfs, in create_client()
2773 clp->cl_clientid.cl_id - nn->clientid_base, in create_client()
2775 clp->cl_nfsd_info_dentry = dentries[0]; in create_client()
2776 if (!clp->cl_nfsd_dentry) { in create_client()
2777 free_client(clp); in create_client()
2780 return clp; in create_client()
2787 struct nfs4_client *clp; in add_clp_to_name_tree() local
2790 clp = rb_entry(*new, struct nfs4_client, cl_namenode); in add_clp_to_name_tree()
2793 if (compare_blob(&clp->cl_name, &new_clp->cl_name) > 0) in add_clp_to_name_tree()
2808 struct nfs4_client *clp; in find_clp_in_name_tree() local
2811 clp = rb_entry(node, struct nfs4_client, cl_namenode); in find_clp_in_name_tree()
2812 cmp = compare_blob(&clp->cl_name, name); in find_clp_in_name_tree()
2818 return clp; in find_clp_in_name_tree()
2824 add_to_unconfirmed(struct nfs4_client *clp) in add_to_unconfirmed() argument
2827 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in add_to_unconfirmed()
2831 clear_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); in add_to_unconfirmed()
2832 add_clp_to_name_tree(clp, &nn->unconf_name_tree); in add_to_unconfirmed()
2833 idhashval = clientid_hashval(clp->cl_clientid.cl_id); in add_to_unconfirmed()
2834 list_add(&clp->cl_idhash, &nn->unconf_id_hashtbl[idhashval]); in add_to_unconfirmed()
2835 renew_client_locked(clp); in add_to_unconfirmed()
2839 move_to_confirmed(struct nfs4_client *clp) in move_to_confirmed() argument
2841 unsigned int idhashval = clientid_hashval(clp->cl_clientid.cl_id); in move_to_confirmed()
2842 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); in move_to_confirmed()
2846 list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); in move_to_confirmed()
2847 rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); in move_to_confirmed()
2848 add_clp_to_name_tree(clp, &nn->conf_name_tree); in move_to_confirmed()
2849 set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); in move_to_confirmed()
2850 trace_nfsd_clid_confirmed(&clp->cl_clientid); in move_to_confirmed()
2851 renew_client_locked(clp); in move_to_confirmed()
2857 struct nfs4_client *clp; in find_client_in_id_table() local
2860 list_for_each_entry(clp, &tbl[idhashval], cl_idhash) { in find_client_in_id_table()
2861 if (same_clid(&clp->cl_clientid, clid)) { in find_client_in_id_table()
2862 if ((bool)clp->cl_minorversion != sessions) in find_client_in_id_table()
2864 renew_client_locked(clp); in find_client_in_id_table()
2865 return clp; in find_client_in_id_table()
2889 static bool clp_used_exchangeid(struct nfs4_client *clp) in clp_used_exchangeid() argument
2891 return clp->cl_exchange_flags != 0; in clp_used_exchangeid()
2909 gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, struct svc_rqst *rqstp) in gen_callback() argument
2911 struct nfs4_cb_conn *conn = &clp->cl_cb_conn; in gen_callback()
2926 conn->cb_addrlen = rpc_uaddr2sockaddr(clp->net, se->se_callback_addr_val, in gen_callback()
2940 trace_nfsd_cb_args(clp, conn); in gen_callback()
2945 trace_nfsd_cb_nodelegs(clp); in gen_callback()
3066 static bool client_has_openowners(struct nfs4_client *clp) in client_has_openowners() argument
3070 list_for_each_entry(oo, &clp->cl_openowners, oo_perclient) { in client_has_openowners()
3077 static bool client_has_state(struct nfs4_client *clp) in client_has_state() argument
3079 return client_has_openowners(clp) in client_has_state()
3081 || !list_empty(&clp->cl_lo_states) in client_has_state()
3083 || !list_empty(&clp->cl_delegations) in client_has_state()
3084 || !list_empty(&clp->cl_sessions) in client_has_state()
3085 || !list_empty(&clp->async_copies); in client_has_state()
3088 static __be32 copy_impl_id(struct nfs4_client *clp, in copy_impl_id() argument
3093 xdr_netobj_dup(&clp->cl_nii_domain, &exid->nii_domain, GFP_KERNEL); in copy_impl_id()
3094 if (!clp->cl_nii_domain.data) in copy_impl_id()
3096 xdr_netobj_dup(&clp->cl_nii_name, &exid->nii_name, GFP_KERNEL); in copy_impl_id()
3097 if (!clp->cl_nii_name.data) in copy_impl_id()
3099 clp->cl_nii_time = exid->nii_time; in copy_impl_id()
3580 struct nfs4_client *clp = session->se_client; in nfsd4_match_existing_connection() local
3586 spin_lock(&clp->cl_lock); in nfsd4_match_existing_connection()
3600 spin_unlock(&clp->cl_lock); in nfsd4_match_existing_connection()
3705 struct nfs4_client *clp = ses->se_client; in nfsd4_sequence_check_conn() local
3710 spin_lock(&clp->cl_lock); in nfsd4_sequence_check_conn()
3715 if (clp->cl_mach_cred) in nfsd4_sequence_check_conn()
3718 spin_unlock(&clp->cl_lock); in nfsd4_sequence_check_conn()
3725 spin_unlock(&clp->cl_lock); in nfsd4_sequence_check_conn()
3786 struct nfs4_client *clp; in nfsd4_sequence() local
3809 clp = session->se_client; in nfsd4_sequence()
3842 cstate->clp = clp; in nfsd4_sequence()
3877 cstate->clp = clp; in nfsd4_sequence()
3880 switch (clp->cl_cb_state) { in nfsd4_sequence()
3890 if (!list_empty(&clp->cl_revoked)) in nfsd4_sequence()
3914 } else if (cs->clp) in nfsd4_sequence_done()
3915 put_client_renew(cs->clp); in nfsd4_sequence_done()
3925 struct nfs4_client *clp = NULL; in nfsd4_destroy_clientid() local
3942 clp = conf; in nfsd4_destroy_clientid()
3944 clp = unconf; in nfsd4_destroy_clientid()
3949 if (!nfsd4_mach_creds_match(clp, rqstp)) { in nfsd4_destroy_clientid()
3950 clp = NULL; in nfsd4_destroy_clientid()
3954 trace_nfsd_clid_destroyed(&clp->cl_clientid); in nfsd4_destroy_clientid()
3955 unhash_client_locked(clp); in nfsd4_destroy_clientid()
3958 if (clp) in nfsd4_destroy_clientid()
3959 expire_client(clp); in nfsd4_destroy_clientid()
3968 struct nfs4_client *clp = cstate->clp; in nfsd4_reclaim_complete() local
3982 if (test_and_set_bit(NFSD4_CLIENT_RECLAIM_COMPLETE, &clp->cl_flags)) in nfsd4_reclaim_complete()
3986 if (is_client_expired(clp)) in nfsd4_reclaim_complete()
3997 trace_nfsd_clid_reclaim_complete(&clp->cl_clientid); in nfsd4_reclaim_complete()
3998 nfsd4_client_record_create(clp); in nfsd4_reclaim_complete()
3999 inc_reclaim_complete(clp); in nfsd4_reclaim_complete()
4261 … void *alloc_stateowner(struct kmem_cache *slab, struct xdr_netobj *owner, struct nfs4_client *clp) in alloc_stateowner() argument
4276 sop->so_client = clp; in alloc_stateowner()
4282 static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, unsigned int strhash… in hash_openowner() argument
4284 lockdep_assert_held(&clp->cl_lock); in hash_openowner()
4287 &clp->cl_ownerstr_hashtbl[strhashval]); in hash_openowner()
4288 list_add(&oo->oo_perclient, &clp->cl_openowners); in hash_openowner()
4382 struct nfs4_client *clp = cstate->clp; in alloc_init_open_stateowner() local
4385 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp); in alloc_init_open_stateowner()
4397 spin_lock(&clp->cl_lock); in alloc_init_open_stateowner()
4398 ret = find_openstateowner_str_locked(strhashval, open, clp); in alloc_init_open_stateowner()
4400 hash_openowner(oo, clp, strhashval); in alloc_init_open_stateowner()
4405 spin_unlock(&clp->cl_lock); in alloc_init_open_stateowner()
4698 struct nfs4_client *clp; in nfsd_breaker_owns_lease() local
4706 clp = *(rqst->rq_lease_breaker); in nfsd_breaker_owns_lease()
4707 return dl->dl_stid.sc_client == clp; in nfsd_breaker_owns_lease()
4754 if (cstate->clp) { in set_client()
4755 if (!same_clid(&cstate->clp->cl_clientid, clid)) in set_client()
4765 cstate->clp = lookup_clientid(clid, false, nn); in set_client()
4766 if (!cstate->clp) in set_client()
4776 struct nfs4_client *clp = NULL; in nfsd4_process_open1() local
4792 clp = cstate->clp; in nfsd4_process_open1()
4795 oo = find_openstateowner_str(strhashval, open, clp); in nfsd4_process_open1()
4816 open->op_stp = nfs4_alloc_open_stateid(clp); in nfsd4_process_open1()
4822 open->op_odstate = alloc_clnt_odstate(clp); in nfsd4_process_open1()
5019 static bool nfsd4_cb_channel_good(struct nfs4_client *clp) in nfsd4_cb_channel_good() argument
5021 if (clp->cl_cb_state == NFSD4_CB_UP) in nfsd4_cb_channel_good()
5028 return clp->cl_minorversion && clp->cl_cb_state == NFSD4_CB_UNKNOWN; in nfsd4_cb_channel_good()
5049 static int nfsd4_check_conflicting_opens(struct nfs4_client *clp, in nfsd4_check_conflicting_opens() argument
5093 st->st_stid.sc_client != clp) { in nfsd4_check_conflicting_opens()
5109 nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, in nfs4_set_delegation() argument
5136 if (nfs4_delegation_exists(clp, fp)) in nfs4_set_delegation()
5154 dp = alloc_init_deleg(clp, fp, fh, odstate); in nfs4_set_delegation()
5167 status = nfsd4_check_conflicting_opens(clp, fp); in nfs4_set_delegation()
5227 struct nfs4_client *clp = stp->st_stid.sc_client; in nfs4_open_delegation() local
5247 if (locks_in_grace(clp->net)) in nfs4_open_delegation()
5255 dp = nfs4_set_delegation(clp, fh, stp->st_stid.sc_file, stp->st_clnt_odstate); in nfs4_open_delegation()
5428 struct nfs4_client *clp; in nfsd4_renew() local
5436 clp = cstate->clp; in nfsd4_renew()
5437 if (!list_empty(&clp->cl_delegations) in nfsd4_renew()
5438 && clp->cl_cb_state != NFSD4_CB_UP) in nfsd4_renew()
5583 struct nfs4_client *clp; in nfs4_laundromat() local
5615 clp = list_entry(pos, struct nfs4_client, cl_lru); in nfs4_laundromat()
5616 if (!state_expired(<, clp->cl_time)) in nfs4_laundromat()
5618 if (mark_client_expired_locked(clp)) in nfs4_laundromat()
5620 list_add(&clp->cl_lru, &reaplist); in nfs4_laundromat()
5624 clp = list_entry(pos, struct nfs4_client, cl_lru); in nfs4_laundromat()
5625 trace_nfsd_clid_purged(&clp->cl_clientid); in nfs4_laundromat()
5626 list_del_init(&clp->cl_lru); in nfs4_laundromat()
5627 expire_client(clp); in nfs4_laundromat()
5869 *s = find_stateid_by_type(cstate->clp, stateid, typemask); in nfsd4_lookup_stateid()
5956 struct nfs4_client *clp, in manage_cpntf_state() argument
5973 if (!clp) in manage_cpntf_state()
5982 if (!clp && state) in manage_cpntf_state()
6097 struct nfs4_client *cl = cstate->clp; in nfsd4_test_stateid()
6143 struct nfs4_client *cl = cstate->clp; in nfsd4_free_stateid()
6375 struct nfs4_client *clp = s->st_stid.sc_client; in nfsd4_close_open_stateid() local
6379 spin_lock(&clp->cl_lock); in nfsd4_close_open_stateid()
6382 if (clp->cl_minorversion) { in nfsd4_close_open_stateid()
6385 spin_unlock(&clp->cl_lock); in nfsd4_close_open_stateid()
6388 spin_unlock(&clp->cl_lock); in nfsd4_close_open_stateid()
6391 move_to_close_lru(s, clp->net); in nfsd4_close_open_stateid()
6583 find_lockowner_str_locked(struct nfs4_client *clp, struct xdr_netobj *owner) in find_lockowner_str_locked() argument
6588 lockdep_assert_held(&clp->cl_lock); in find_lockowner_str_locked()
6590 list_for_each_entry(so, &clp->cl_ownerstr_hashtbl[strhashval], in find_lockowner_str_locked()
6601 find_lockowner_str(struct nfs4_client *clp, struct xdr_netobj *owner) in find_lockowner_str() argument
6605 spin_lock(&clp->cl_lock); in find_lockowner_str()
6606 lo = find_lockowner_str_locked(clp, owner); in find_lockowner_str()
6607 spin_unlock(&clp->cl_lock); in find_lockowner_str()
6636 alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, in alloc_init_lock_stateowner() argument
6642 lo = alloc_stateowner(lockowner_slab, &lock->lk_new_owner, clp); in alloc_init_lock_stateowner()
6650 spin_lock(&clp->cl_lock); in alloc_init_lock_stateowner()
6651 ret = find_lockowner_str_locked(clp, &lock->lk_new_owner); in alloc_init_lock_stateowner()
6654 &clp->cl_ownerstr_hashtbl[strhashval]); in alloc_init_lock_stateowner()
6659 spin_unlock(&clp->cl_lock); in alloc_init_lock_stateowner()
6687 struct nfs4_client *clp = lo->lo_owner.so_client; in init_lock_stateid() local
6693 spin_lock(&clp->cl_lock); in init_lock_stateid()
6712 spin_unlock(&clp->cl_lock); in init_lock_stateid()
6715 spin_unlock(&clp->cl_lock); in init_lock_stateid()
6724 spin_unlock(&clp->cl_lock); in init_lock_stateid()
6737 struct nfs4_client *clp = oo->oo_owner.so_client; in find_or_create_lock_stateid() local
6740 spin_lock(&clp->cl_lock); in find_or_create_lock_stateid()
6742 spin_unlock(&clp->cl_lock); in find_or_create_lock_stateid()
6748 ns = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_lock_stateid); in find_or_create_lock_stateid()
6867 &cstate->clp->cl_clientid, in nfsd4_lock()
7121 lo = find_lockowner_str(cstate->clp, &lockt->lt_owner); in nfsd4_lockt()
7269 struct nfs4_client *clp; in nfsd4_release_lockowner() local
7279 clp = cstate->clp; in nfsd4_release_lockowner()
7281 spin_lock(&clp->cl_lock); in nfsd4_release_lockowner()
7282 list_for_each_entry(sop, &clp->cl_ownerstr_hashtbl[hashval], in nfsd4_release_lockowner()
7293 spin_unlock(&clp->cl_lock); in nfsd4_release_lockowner()
7302 spin_unlock(&clp->cl_lock); in nfsd4_release_lockowner()
7314 spin_unlock(&clp->cl_lock); in nfsd4_release_lockowner()
7409 nfs4_check_open_reclaim(struct nfs4_client *clp) in nfs4_check_open_reclaim() argument
7411 if (test_bit(NFSD4_CLIENT_RECLAIM_COMPLETE, &clp->cl_flags)) in nfs4_check_open_reclaim()
7414 if (nfsd4_client_record_check(clp)) in nfs4_check_open_reclaim()
7501 struct nfs4_client *clp = NULL; in nfs4_state_destroy_net() local
7506 clp = list_entry(nn->conf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); in nfs4_state_destroy_net()
7507 destroy_client(clp); in nfs4_state_destroy_net()
7515 clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); in nfs4_state_destroy_net()
7516 destroy_client(clp); in nfs4_state_destroy_net()