Lines Matching refs:clp

153 	struct nfs_client *clp;  in nfs_alloc_client()  local
157 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) in nfs_alloc_client()
160 clp->cl_nfs_mod = cl_init->nfs_mod; in nfs_alloc_client()
161 if (!try_module_get(clp->cl_nfs_mod->owner)) in nfs_alloc_client()
164 clp->rpc_ops = clp->cl_nfs_mod->rpc_ops; in nfs_alloc_client()
166 refcount_set(&clp->cl_count, 1); in nfs_alloc_client()
167 clp->cl_cons_state = NFS_CS_INITING; in nfs_alloc_client()
169 memcpy(&clp->cl_addr, cl_init->addr, cl_init->addrlen); in nfs_alloc_client()
170 clp->cl_addrlen = cl_init->addrlen; in nfs_alloc_client()
174 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL); in nfs_alloc_client()
175 if (!clp->cl_hostname) in nfs_alloc_client()
179 INIT_LIST_HEAD(&clp->cl_superblocks); in nfs_alloc_client()
180 clp->cl_rpcclient = ERR_PTR(-EINVAL); in nfs_alloc_client()
182 clp->cl_proto = cl_init->proto; in nfs_alloc_client()
183 clp->cl_net = get_net(cl_init->net); in nfs_alloc_client()
187 clp->cl_machine_cred = cred; in nfs_alloc_client()
188 nfs_fscache_get_client_cookie(clp); in nfs_alloc_client()
190 return clp; in nfs_alloc_client()
193 put_nfs_version(clp->cl_nfs_mod); in nfs_alloc_client()
195 kfree(clp); in nfs_alloc_client()
210 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
212 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_cb_idr_remove_locked()
214 if (clp->cl_cb_ident) in nfs_cb_idr_remove_locked()
215 idr_remove(&nn->cb_ident_idr, clp->cl_cb_ident); in nfs_cb_idr_remove_locked()
228 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
241 void nfs_free_client(struct nfs_client *clp) in nfs_free_client() argument
243 nfs_fscache_release_client_cookie(clp); in nfs_free_client()
246 if (!IS_ERR(clp->cl_rpcclient)) in nfs_free_client()
247 rpc_shutdown_client(clp->cl_rpcclient); in nfs_free_client()
249 if (clp->cl_machine_cred != NULL) in nfs_free_client()
250 put_rpccred(clp->cl_machine_cred); in nfs_free_client()
252 put_net(clp->cl_net); in nfs_free_client()
253 put_nfs_version(clp->cl_nfs_mod); in nfs_free_client()
254 kfree(clp->cl_hostname); in nfs_free_client()
255 kfree(clp->cl_acceptor); in nfs_free_client()
256 kfree(clp); in nfs_free_client()
263 void nfs_put_client(struct nfs_client *clp) in nfs_put_client() argument
267 if (!clp) in nfs_put_client()
270 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_put_client()
272 if (refcount_dec_and_lock(&clp->cl_count, &nn->nfs_client_lock)) { in nfs_put_client()
273 list_del(&clp->cl_share_link); in nfs_put_client()
274 nfs_cb_idr_remove_locked(clp); in nfs_put_client()
277 WARN_ON_ONCE(!list_empty(&clp->cl_superblocks)); in nfs_put_client()
279 clp->rpc_ops->free_client(clp); in nfs_put_client()
290 struct nfs_client *clp; in nfs_match_client() local
295 list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { in nfs_match_client()
296 const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; in nfs_match_client()
298 if (clp->cl_cons_state < 0) in nfs_match_client()
302 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_match_client()
303 refcount_inc(&clp->cl_count); in nfs_match_client()
305 nfs_wait_client_init_complete(clp); in nfs_match_client()
306 nfs_put_client(clp); in nfs_match_client()
312 if (clp->rpc_ops != data->nfs_mod->rpc_ops) in nfs_match_client()
315 if (clp->cl_proto != data->proto) in nfs_match_client()
318 if (clp->cl_minorversion != data->minorversion) in nfs_match_client()
323 if (IS_ERR(clp->cl_rpcclient) || in nfs_match_client()
324 !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, in nfs_match_client()
328 refcount_inc(&clp->cl_count); in nfs_match_client()
329 return clp; in nfs_match_client()
339 bool nfs_client_init_is_complete(const struct nfs_client *clp) in nfs_client_init_is_complete() argument
341 return clp->cl_cons_state <= NFS_CS_READY; in nfs_client_init_is_complete()
351 int nfs_client_init_status(const struct nfs_client *clp) in nfs_client_init_status() argument
354 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_client_init_status()
358 return clp->cl_cons_state; in nfs_client_init_status()
362 int nfs_wait_client_init_complete(const struct nfs_client *clp) in nfs_wait_client_init_complete() argument
365 nfs_client_init_is_complete(clp)); in nfs_wait_client_init_complete()
374 struct nfs_client *clp) in nfs_found_client() argument
378 error = nfs_wait_client_init_complete(clp); in nfs_found_client()
380 nfs_put_client(clp); in nfs_found_client()
384 if (clp->cl_cons_state < NFS_CS_READY) { in nfs_found_client()
385 error = clp->cl_cons_state; in nfs_found_client()
386 nfs_put_client(clp); in nfs_found_client()
391 return clp; in nfs_found_client()
400 struct nfs_client *clp, *new = NULL; in nfs_get_client() local
413 clp = nfs_match_client(cl_init); in nfs_get_client()
414 if (clp) { in nfs_get_client()
418 return nfs_found_client(cl_init, clp); in nfs_get_client()
440 void nfs_mark_client_ready(struct nfs_client *clp, int state) in nfs_mark_client_ready() argument
443 clp->cl_cons_state = state; in nfs_mark_client_ready()
493 int nfs_create_rpc_client(struct nfs_client *clp, in nfs_create_rpc_client() argument
499 .net = clp->cl_net, in nfs_create_rpc_client()
500 .protocol = clp->cl_proto, in nfs_create_rpc_client()
501 .address = (struct sockaddr *)&clp->cl_addr, in nfs_create_rpc_client()
502 .addrsize = clp->cl_addrlen, in nfs_create_rpc_client()
504 .servername = clp->cl_hostname, in nfs_create_rpc_client()
507 .version = clp->rpc_ops->version, in nfs_create_rpc_client()
511 if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) in nfs_create_rpc_client()
513 if (test_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags)) in nfs_create_rpc_client()
515 if (test_bit(NFS_CS_NORESVPORT, &clp->cl_flags)) in nfs_create_rpc_client()
517 if (test_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags)) in nfs_create_rpc_client()
520 if (!IS_ERR(clp->cl_rpcclient)) in nfs_create_rpc_client()
530 clp->cl_rpcclient = clnt; in nfs_create_rpc_client()
550 struct nfs_client *clp = server->nfs_client; in nfs_start_lockd() local
552 .hostname = clp->cl_hostname, in nfs_start_lockd()
553 .address = (struct sockaddr *)&clp->cl_addr, in nfs_start_lockd()
554 .addrlen = clp->cl_addrlen, in nfs_start_lockd()
555 .nfs_version = clp->rpc_ops->version, in nfs_start_lockd()
558 .net = clp->cl_net, in nfs_start_lockd()
559 .nlmclnt_ops = clp->cl_nfs_mod->rpc_ops->nlmclnt_ops, in nfs_start_lockd()
568 switch (clp->cl_proto) { in nfs_start_lockd()
592 struct nfs_client *clp = server->nfs_client; in nfs_init_server_rpcclient() local
594 server->client = rpc_clone_client_set_auth(clp->cl_rpcclient, in nfs_init_server_rpcclient()
621 struct nfs_client *nfs_init_client(struct nfs_client *clp, in nfs_init_client() argument
627 if (clp->cl_cons_state == NFS_CS_READY) in nfs_init_client()
628 return clp; in nfs_init_client()
634 error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); in nfs_init_client()
635 nfs_mark_client_ready(clp, error == 0 ? NFS_CS_READY : error); in nfs_init_client()
637 nfs_put_client(clp); in nfs_init_client()
638 clp = ERR_PTR(error); in nfs_init_client()
640 return clp; in nfs_init_client()
661 struct nfs_client *clp; in nfs_init_server() local
670 clp = nfs_get_client(&cl_init); in nfs_init_server()
671 if (IS_ERR(clp)) in nfs_init_server()
672 return PTR_ERR(clp); in nfs_init_server()
674 server->nfs_client = clp; in nfs_init_server()
721 nfs_put_client(clp); in nfs_init_server()
785 struct nfs_client *clp = server->nfs_client; in nfs_probe_fsinfo() local
788 if (clp->rpc_ops->set_capabilities != NULL) { in nfs_probe_fsinfo()
789 error = clp->rpc_ops->set_capabilities(server, mntfh); in nfs_probe_fsinfo()
797 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo); in nfs_probe_fsinfo()
810 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) in nfs_probe_fsinfo()
839 struct nfs_client *clp = server->nfs_client; in nfs_server_insert_lists() local
840 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_insert_lists()
843 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks); in nfs_server_insert_lists()
845 clear_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_insert_lists()
853 struct nfs_client *clp = server->nfs_client; in nfs_server_remove_lists() local
856 if (clp == NULL) in nfs_server_remove_lists()
858 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_remove_lists()
861 if (list_empty(&clp->cl_superblocks)) in nfs_server_remove_lists()
862 set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_remove_lists()
1135 struct nfs_client *clp; in nfs_server_list_show() local
1145 clp = list_entry(v, struct nfs_client, cl_share_link); in nfs_server_list_show()
1148 if (clp->cl_cons_state != NFS_CS_READY) in nfs_server_list_show()
1153 clp->rpc_ops->version, in nfs_server_list_show()
1154 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_server_list_show()
1155 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_server_list_show()
1156 refcount_read(&clp->cl_count), in nfs_server_list_show()
1157 clp->cl_hostname); in nfs_server_list_show()
1203 struct nfs_client *clp; in nfs_volume_list_show() local
1216 clp = server->nfs_client; in nfs_volume_list_show()
1227 clp->rpc_ops->version, in nfs_volume_list_show()
1228 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_volume_list_show()
1229 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_volume_list_show()