Lines Matching refs:clp

151 	struct nfs_client *clp;  in nfs_alloc_client()  local
154 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) in nfs_alloc_client()
157 clp->cl_minorversion = cl_init->minorversion; in nfs_alloc_client()
158 clp->cl_nfs_mod = cl_init->nfs_mod; in nfs_alloc_client()
159 if (!try_module_get(clp->cl_nfs_mod->owner)) in nfs_alloc_client()
162 clp->rpc_ops = clp->cl_nfs_mod->rpc_ops; in nfs_alloc_client()
164 refcount_set(&clp->cl_count, 1); in nfs_alloc_client()
165 clp->cl_cons_state = NFS_CS_INITING; in nfs_alloc_client()
167 memcpy(&clp->cl_addr, cl_init->addr, cl_init->addrlen); in nfs_alloc_client()
168 clp->cl_addrlen = cl_init->addrlen; in nfs_alloc_client()
172 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL); in nfs_alloc_client()
173 if (!clp->cl_hostname) in nfs_alloc_client()
177 INIT_LIST_HEAD(&clp->cl_superblocks); in nfs_alloc_client()
178 clp->cl_rpcclient = ERR_PTR(-EINVAL); in nfs_alloc_client()
180 clp->cl_flags = cl_init->init_flags; in nfs_alloc_client()
181 clp->cl_proto = cl_init->proto; in nfs_alloc_client()
182 clp->cl_nconnect = cl_init->nconnect; in nfs_alloc_client()
183 clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect : 1; in nfs_alloc_client()
184 clp->cl_net = get_net(cl_init->net); in nfs_alloc_client()
186 clp->cl_principal = "*"; in nfs_alloc_client()
187 clp->cl_xprtsec = cl_init->xprtsec; in nfs_alloc_client()
188 return clp; in nfs_alloc_client()
191 put_nfs_version(clp->cl_nfs_mod); in nfs_alloc_client()
193 kfree(clp); in nfs_alloc_client()
208 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
210 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_cb_idr_remove_locked()
212 if (clp->cl_cb_ident) in nfs_cb_idr_remove_locked()
213 idr_remove(&nn->cb_ident_idr, clp->cl_cb_ident); in nfs_cb_idr_remove_locked()
226 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
239 void nfs_free_client(struct nfs_client *clp) in nfs_free_client() argument
242 if (!IS_ERR(clp->cl_rpcclient)) in nfs_free_client()
243 rpc_shutdown_client(clp->cl_rpcclient); in nfs_free_client()
245 put_net(clp->cl_net); in nfs_free_client()
246 put_nfs_version(clp->cl_nfs_mod); in nfs_free_client()
247 kfree(clp->cl_hostname); in nfs_free_client()
248 kfree(clp->cl_acceptor); in nfs_free_client()
249 kfree(clp); in nfs_free_client()
256 void nfs_put_client(struct nfs_client *clp) in nfs_put_client() argument
260 if (!clp) in nfs_put_client()
263 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_put_client()
265 if (refcount_dec_and_lock(&clp->cl_count, &nn->nfs_client_lock)) { in nfs_put_client()
266 list_del(&clp->cl_share_link); in nfs_put_client()
267 nfs_cb_idr_remove_locked(clp); in nfs_put_client()
270 WARN_ON_ONCE(!list_empty(&clp->cl_superblocks)); in nfs_put_client()
272 clp->rpc_ops->free_client(clp); in nfs_put_client()
283 struct nfs_client *clp; in nfs_match_client() local
289 list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { in nfs_match_client()
290 const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; in nfs_match_client()
292 if (clp->cl_cons_state < 0) in nfs_match_client()
296 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_match_client()
297 refcount_inc(&clp->cl_count); in nfs_match_client()
299 error = nfs_wait_client_init_complete(clp); in nfs_match_client()
300 nfs_put_client(clp); in nfs_match_client()
308 if (clp->rpc_ops != data->nfs_mod->rpc_ops) in nfs_match_client()
311 if (clp->cl_proto != data->proto) in nfs_match_client()
314 if (clp->cl_minorversion != data->minorversion) in nfs_match_client()
319 test_bit(NFS_CS_DS, &clp->cl_flags)) in nfs_match_client()
325 if (IS_ERR(clp->cl_rpcclient) || in nfs_match_client()
326 !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, in nfs_match_client()
331 if (clp->cl_xprtsec.policy != data->xprtsec.policy) in nfs_match_client()
334 refcount_inc(&clp->cl_count); in nfs_match_client()
335 return clp; in nfs_match_client()
345 bool nfs_client_init_is_complete(const struct nfs_client *clp) in nfs_client_init_is_complete() argument
347 return clp->cl_cons_state <= NFS_CS_READY; in nfs_client_init_is_complete()
357 int nfs_client_init_status(const struct nfs_client *clp) in nfs_client_init_status() argument
360 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_client_init_status()
364 return clp->cl_cons_state; in nfs_client_init_status()
368 int nfs_wait_client_init_complete(const struct nfs_client *clp) in nfs_wait_client_init_complete() argument
371 nfs_client_init_is_complete(clp)); in nfs_wait_client_init_complete()
380 struct nfs_client *clp) in nfs_found_client() argument
384 error = nfs_wait_client_init_complete(clp); in nfs_found_client()
386 nfs_put_client(clp); in nfs_found_client()
390 if (clp->cl_cons_state < NFS_CS_READY) { in nfs_found_client()
391 error = clp->cl_cons_state; in nfs_found_client()
392 nfs_put_client(clp); in nfs_found_client()
397 return clp; in nfs_found_client()
406 struct nfs_client *clp, *new = NULL; in nfs_get_client() local
419 clp = nfs_match_client(cl_init); in nfs_get_client()
420 if (clp) { in nfs_get_client()
424 if (IS_ERR(clp)) in nfs_get_client()
425 return clp; in nfs_get_client()
426 return nfs_found_client(cl_init, clp); in nfs_get_client()
447 void nfs_mark_client_ready(struct nfs_client *clp, int state) in nfs_mark_client_ready() argument
450 clp->cl_cons_state = state; in nfs_mark_client_ready()
501 int nfs_create_rpc_client(struct nfs_client *clp, in nfs_create_rpc_client() argument
507 .net = clp->cl_net, in nfs_create_rpc_client()
508 .protocol = clp->cl_proto, in nfs_create_rpc_client()
509 .nconnect = clp->cl_nconnect, in nfs_create_rpc_client()
510 .address = (struct sockaddr *)&clp->cl_addr, in nfs_create_rpc_client()
511 .addrsize = clp->cl_addrlen, in nfs_create_rpc_client()
513 .servername = clp->cl_hostname, in nfs_create_rpc_client()
516 .version = clp->rpc_ops->version, in nfs_create_rpc_client()
524 if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) in nfs_create_rpc_client()
526 if (test_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags)) in nfs_create_rpc_client()
528 if (test_bit(NFS_CS_NORESVPORT, &clp->cl_flags)) in nfs_create_rpc_client()
530 if (test_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags)) in nfs_create_rpc_client()
532 if (test_bit(NFS_CS_NOPING, &clp->cl_flags)) in nfs_create_rpc_client()
534 if (test_bit(NFS_CS_REUSEPORT, &clp->cl_flags)) in nfs_create_rpc_client()
537 if (!IS_ERR(clp->cl_rpcclient)) in nfs_create_rpc_client()
547 clnt->cl_principal = clp->cl_principal; in nfs_create_rpc_client()
548 clp->cl_rpcclient = clnt; in nfs_create_rpc_client()
549 clnt->cl_max_connect = clp->cl_max_connect; in nfs_create_rpc_client()
569 struct nfs_client *clp = server->nfs_client; in nfs_start_lockd() local
571 .hostname = clp->cl_hostname, in nfs_start_lockd()
572 .address = (struct sockaddr *)&clp->cl_addr, in nfs_start_lockd()
573 .addrlen = clp->cl_addrlen, in nfs_start_lockd()
574 .nfs_version = clp->rpc_ops->version, in nfs_start_lockd()
577 .net = clp->cl_net, in nfs_start_lockd()
578 .nlmclnt_ops = clp->cl_nfs_mod->rpc_ops->nlmclnt_ops, in nfs_start_lockd()
588 switch (clp->cl_proto) { in nfs_start_lockd()
615 struct nfs_client *clp = server->nfs_client; in nfs_init_server_rpcclient() local
617 server->client = rpc_clone_client_set_auth(clp->cl_rpcclient, in nfs_init_server_rpcclient()
647 struct nfs_client *nfs_init_client(struct nfs_client *clp, in nfs_init_client() argument
653 if (clp->cl_cons_state == NFS_CS_READY) in nfs_init_client()
654 return clp; in nfs_init_client()
660 error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); in nfs_init_client()
661 nfs_mark_client_ready(clp, error == 0 ? NFS_CS_READY : error); in nfs_init_client()
663 nfs_put_client(clp); in nfs_init_client()
664 clp = ERR_PTR(error); in nfs_init_client()
666 return clp; in nfs_init_client()
691 struct nfs_client *clp; in nfs_init_server() local
700 clp = nfs_get_client(&cl_init); in nfs_init_server()
701 if (IS_ERR(clp)) in nfs_init_server()
702 return PTR_ERR(clp); in nfs_init_server()
704 server->nfs_client = clp; in nfs_init_server()
706 nfs_sysfs_link_rpc_client(server, clp->cl_rpcclient, "_state"); in nfs_init_server()
713 switch (clp->rpc_ops->version) { in nfs_init_server()
725 server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto); in nfs_init_server()
727 server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto); in nfs_init_server()
762 nfs_put_client(clp); in nfs_init_server()
772 struct nfs_client *clp = server->nfs_client; in nfs_server_set_fsinfo() local
777 server->rsize = nfs_io_size(fsinfo->rtpref, clp->cl_proto); in nfs_server_set_fsinfo()
779 server->wsize = nfs_io_size(fsinfo->wtpref, clp->cl_proto); in nfs_server_set_fsinfo()
782 server->rsize = nfs_io_size(fsinfo->rtmax, clp->cl_proto); in nfs_server_set_fsinfo()
784 server->wsize = nfs_io_size(fsinfo->wtmax, clp->cl_proto); in nfs_server_set_fsinfo()
845 struct nfs_client *clp = server->nfs_client; in nfs_probe_fsinfo() local
848 if (clp->rpc_ops->set_capabilities != NULL) { in nfs_probe_fsinfo()
849 error = clp->rpc_ops->set_capabilities(server, mntfh); in nfs_probe_fsinfo()
857 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo); in nfs_probe_fsinfo()
870 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) in nfs_probe_fsinfo()
874 if (clp->rpc_ops->discover_trunking != NULL && in nfs_probe_fsinfo()
877 error = clp->rpc_ops->discover_trunking(server, mntfh); in nfs_probe_fsinfo()
930 struct nfs_client *clp = server->nfs_client; in nfs_server_insert_lists() local
931 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_insert_lists()
934 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks); in nfs_server_insert_lists()
936 clear_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_insert_lists()
944 struct nfs_client *clp = server->nfs_client; in nfs_server_remove_lists() local
947 if (clp == NULL) in nfs_server_remove_lists()
949 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_remove_lists()
952 if (list_empty(&clp->cl_superblocks)) in nfs_server_remove_lists()
953 set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_remove_lists()
1256 struct nfs_client *clp; in nfs_server_list_show() local
1266 clp = list_entry(v, struct nfs_client, cl_share_link); in nfs_server_list_show()
1269 if (clp->cl_cons_state != NFS_CS_READY) in nfs_server_list_show()
1274 clp->rpc_ops->version, in nfs_server_list_show()
1275 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_server_list_show()
1276 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_server_list_show()
1277 refcount_read(&clp->cl_count), in nfs_server_list_show()
1278 clp->cl_hostname); in nfs_server_list_show()
1324 struct nfs_client *clp; in nfs_volume_list_show() local
1337 clp = server->nfs_client; in nfs_volume_list_show()
1348 clp->rpc_ops->version, in nfs_volume_list_show()
1349 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_volume_list_show()
1350 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_volume_list_show()