Lines Matching refs:clp

152 	struct nfs_client *clp;  in nfs_alloc_client()  local
156 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) in nfs_alloc_client()
159 clp->cl_nfs_mod = cl_init->nfs_mod; in nfs_alloc_client()
160 if (!try_module_get(clp->cl_nfs_mod->owner)) in nfs_alloc_client()
163 clp->rpc_ops = clp->cl_nfs_mod->rpc_ops; in nfs_alloc_client()
165 atomic_set(&clp->cl_count, 1); in nfs_alloc_client()
166 clp->cl_cons_state = NFS_CS_INITING; in nfs_alloc_client()
168 memcpy(&clp->cl_addr, cl_init->addr, cl_init->addrlen); in nfs_alloc_client()
169 clp->cl_addrlen = cl_init->addrlen; in nfs_alloc_client()
173 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL); in nfs_alloc_client()
174 if (!clp->cl_hostname) in nfs_alloc_client()
178 INIT_LIST_HEAD(&clp->cl_superblocks); in nfs_alloc_client()
179 clp->cl_rpcclient = ERR_PTR(-EINVAL); in nfs_alloc_client()
181 clp->cl_proto = cl_init->proto; in nfs_alloc_client()
182 clp->cl_net = get_net(cl_init->net); in nfs_alloc_client()
186 clp->cl_machine_cred = cred; in nfs_alloc_client()
187 nfs_fscache_get_client_cookie(clp); in nfs_alloc_client()
189 return clp; in nfs_alloc_client()
192 put_nfs_version(clp->cl_nfs_mod); in nfs_alloc_client()
194 kfree(clp); in nfs_alloc_client()
209 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
211 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_cb_idr_remove_locked()
213 if (clp->cl_cb_ident) in nfs_cb_idr_remove_locked()
214 idr_remove(&nn->cb_ident_idr, clp->cl_cb_ident); in nfs_cb_idr_remove_locked()
227 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
240 void nfs_free_client(struct nfs_client *clp) in nfs_free_client() argument
242 dprintk("--> nfs_free_client(%u)\n", clp->rpc_ops->version); in nfs_free_client()
244 nfs_fscache_release_client_cookie(clp); in nfs_free_client()
247 if (!IS_ERR(clp->cl_rpcclient)) in nfs_free_client()
248 rpc_shutdown_client(clp->cl_rpcclient); in nfs_free_client()
250 if (clp->cl_machine_cred != NULL) in nfs_free_client()
251 put_rpccred(clp->cl_machine_cred); in nfs_free_client()
253 put_net(clp->cl_net); in nfs_free_client()
254 put_nfs_version(clp->cl_nfs_mod); in nfs_free_client()
255 kfree(clp->cl_hostname); in nfs_free_client()
256 kfree(clp->cl_acceptor); in nfs_free_client()
257 kfree(clp); in nfs_free_client()
266 void nfs_put_client(struct nfs_client *clp) in nfs_put_client() argument
270 if (!clp) in nfs_put_client()
273 dprintk("--> nfs_put_client({%d})\n", atomic_read(&clp->cl_count)); in nfs_put_client()
274 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_put_client()
276 if (atomic_dec_and_lock(&clp->cl_count, &nn->nfs_client_lock)) { in nfs_put_client()
277 list_del(&clp->cl_share_link); in nfs_put_client()
278 nfs_cb_idr_remove_locked(clp); in nfs_put_client()
281 WARN_ON_ONCE(!list_empty(&clp->cl_superblocks)); in nfs_put_client()
283 clp->rpc_ops->free_client(clp); in nfs_put_client()
404 struct nfs_client *clp; in nfs_match_client() local
408 list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { in nfs_match_client()
409 const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; in nfs_match_client()
411 if (clp->cl_cons_state < 0) in nfs_match_client()
415 if (clp->rpc_ops != data->nfs_mod->rpc_ops) in nfs_match_client()
418 if (clp->cl_proto != data->proto) in nfs_match_client()
421 if (clp->cl_minorversion != data->minorversion) in nfs_match_client()
427 atomic_inc(&clp->cl_count); in nfs_match_client()
428 return clp; in nfs_match_client()
433 static bool nfs_client_init_is_complete(const struct nfs_client *clp) in nfs_client_init_is_complete() argument
435 return clp->cl_cons_state <= NFS_CS_READY; in nfs_client_init_is_complete()
438 int nfs_wait_client_init_complete(const struct nfs_client *clp) in nfs_wait_client_init_complete() argument
441 nfs_client_init_is_complete(clp)); in nfs_wait_client_init_complete()
450 struct nfs_client *clp) in nfs_found_client() argument
454 error = nfs_wait_client_init_complete(clp); in nfs_found_client()
456 nfs_put_client(clp); in nfs_found_client()
460 if (clp->cl_cons_state < NFS_CS_READY) { in nfs_found_client()
461 error = clp->cl_cons_state; in nfs_found_client()
462 nfs_put_client(clp); in nfs_found_client()
469 __func__, clp, cl_init->hostname ?: ""); in nfs_found_client()
470 return clp; in nfs_found_client()
483 struct nfs_client *clp, *new = NULL; in nfs_get_client() local
499 clp = nfs_match_client(cl_init); in nfs_get_client()
500 if (clp) { in nfs_get_client()
504 return nfs_found_client(cl_init, clp); in nfs_get_client()
528 void nfs_mark_client_ready(struct nfs_client *clp, int state) in nfs_mark_client_ready() argument
531 clp->cl_cons_state = state; in nfs_mark_client_ready()
581 int nfs_create_rpc_client(struct nfs_client *clp, in nfs_create_rpc_client() argument
587 .net = clp->cl_net, in nfs_create_rpc_client()
588 .protocol = clp->cl_proto, in nfs_create_rpc_client()
589 .address = (struct sockaddr *)&clp->cl_addr, in nfs_create_rpc_client()
590 .addrsize = clp->cl_addrlen, in nfs_create_rpc_client()
592 .servername = clp->cl_hostname, in nfs_create_rpc_client()
594 .version = clp->rpc_ops->version, in nfs_create_rpc_client()
598 if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) in nfs_create_rpc_client()
600 if (test_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags)) in nfs_create_rpc_client()
602 if (test_bit(NFS_CS_NORESVPORT, &clp->cl_flags)) in nfs_create_rpc_client()
604 if (test_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags)) in nfs_create_rpc_client()
607 if (!IS_ERR(clp->cl_rpcclient)) in nfs_create_rpc_client()
617 clp->cl_rpcclient = clnt; in nfs_create_rpc_client()
637 struct nfs_client *clp = server->nfs_client; in nfs_start_lockd() local
639 .hostname = clp->cl_hostname, in nfs_start_lockd()
640 .address = (struct sockaddr *)&clp->cl_addr, in nfs_start_lockd()
641 .addrlen = clp->cl_addrlen, in nfs_start_lockd()
642 .nfs_version = clp->rpc_ops->version, in nfs_start_lockd()
645 .net = clp->cl_net, in nfs_start_lockd()
654 switch (clp->cl_proto) { in nfs_start_lockd()
678 struct nfs_client *clp = server->nfs_client; in nfs_init_server_rpcclient() local
680 server->client = rpc_clone_client_set_auth(clp->cl_rpcclient, in nfs_init_server_rpcclient()
708 struct nfs_client *nfs_init_client(struct nfs_client *clp, in nfs_init_client() argument
714 if (clp->cl_cons_state == NFS_CS_READY) { in nfs_init_client()
716 dprintk("<-- nfs_init_client() = 0 [already %p]\n", clp); in nfs_init_client()
717 return clp; in nfs_init_client()
724 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX); in nfs_init_client()
727 nfs_mark_client_ready(clp, NFS_CS_READY); in nfs_init_client()
728 return clp; in nfs_init_client()
731 nfs_mark_client_ready(clp, error); in nfs_init_client()
732 nfs_put_client(clp); in nfs_init_client()
754 struct nfs_client *clp; in nfs_init_server() local
765 clp = nfs_get_client(&cl_init, &timeparms, NULL, RPC_AUTH_UNIX); in nfs_init_server()
766 if (IS_ERR(clp)) { in nfs_init_server()
767 dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp)); in nfs_init_server()
768 return PTR_ERR(clp); in nfs_init_server()
771 server->nfs_client = clp; in nfs_init_server()
814 dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp); in nfs_init_server()
819 nfs_put_client(clp); in nfs_init_server()
887 struct nfs_client *clp = server->nfs_client; in nfs_probe_fsinfo() local
892 if (clp->rpc_ops->set_capabilities != NULL) { in nfs_probe_fsinfo()
893 error = clp->rpc_ops->set_capabilities(server, mntfh); in nfs_probe_fsinfo()
900 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo); in nfs_probe_fsinfo()
913 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) in nfs_probe_fsinfo()
946 struct nfs_client *clp = server->nfs_client; in nfs_server_insert_lists() local
947 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_insert_lists()
950 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks); in nfs_server_insert_lists()
952 clear_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_insert_lists()
960 struct nfs_client *clp = server->nfs_client; in nfs_server_remove_lists() local
963 if (clp == NULL) in nfs_server_remove_lists()
965 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_remove_lists()
968 if (list_empty(&clp->cl_superblocks)) in nfs_server_remove_lists()
969 set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_remove_lists()
1289 struct nfs_client *clp; in nfs_server_list_show() local
1299 clp = list_entry(v, struct nfs_client, cl_share_link); in nfs_server_list_show()
1302 if (clp->cl_cons_state != NFS_CS_READY) in nfs_server_list_show()
1307 clp->rpc_ops->version, in nfs_server_list_show()
1308 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_server_list_show()
1309 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_server_list_show()
1310 atomic_read(&clp->cl_count), in nfs_server_list_show()
1311 clp->cl_hostname); in nfs_server_list_show()
1366 struct nfs_client *clp; in nfs_volume_list_show() local
1377 clp = server->nfs_client; in nfs_volume_list_show()
1388 clp->rpc_ops->version, in nfs_volume_list_show()
1389 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_volume_list_show()
1390 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_volume_list_show()