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 return clp; in nfs_alloc_client()
190 put_nfs_version(clp->cl_nfs_mod); in nfs_alloc_client()
192 kfree(clp); in nfs_alloc_client()
207 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
209 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_cb_idr_remove_locked()
211 if (clp->cl_cb_ident) in nfs_cb_idr_remove_locked()
212 idr_remove(&nn->cb_ident_idr, clp->cl_cb_ident); in nfs_cb_idr_remove_locked()
225 static void nfs_cb_idr_remove_locked(struct nfs_client *clp) in nfs_cb_idr_remove_locked() argument
238 void nfs_free_client(struct nfs_client *clp) in nfs_free_client() argument
241 if (!IS_ERR(clp->cl_rpcclient)) in nfs_free_client()
242 rpc_shutdown_client(clp->cl_rpcclient); in nfs_free_client()
244 put_net(clp->cl_net); in nfs_free_client()
245 put_nfs_version(clp->cl_nfs_mod); in nfs_free_client()
246 kfree(clp->cl_hostname); in nfs_free_client()
247 kfree(clp->cl_acceptor); in nfs_free_client()
248 kfree(clp); in nfs_free_client()
255 void nfs_put_client(struct nfs_client *clp) in nfs_put_client() argument
259 if (!clp) in nfs_put_client()
262 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_put_client()
264 if (refcount_dec_and_lock(&clp->cl_count, &nn->nfs_client_lock)) { in nfs_put_client()
265 list_del(&clp->cl_share_link); in nfs_put_client()
266 nfs_cb_idr_remove_locked(clp); in nfs_put_client()
269 WARN_ON_ONCE(!list_empty(&clp->cl_superblocks)); in nfs_put_client()
271 clp->rpc_ops->free_client(clp); in nfs_put_client()
282 struct nfs_client *clp; in nfs_match_client() local
288 list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { in nfs_match_client()
289 const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; in nfs_match_client()
291 if (clp->cl_cons_state < 0) in nfs_match_client()
295 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_match_client()
296 refcount_inc(&clp->cl_count); in nfs_match_client()
298 error = nfs_wait_client_init_complete(clp); in nfs_match_client()
299 nfs_put_client(clp); in nfs_match_client()
307 if (clp->rpc_ops != data->nfs_mod->rpc_ops) in nfs_match_client()
310 if (clp->cl_proto != data->proto) in nfs_match_client()
313 if (clp->cl_minorversion != data->minorversion) in nfs_match_client()
318 test_bit(NFS_CS_DS, &clp->cl_flags)) in nfs_match_client()
324 if (IS_ERR(clp->cl_rpcclient) || in nfs_match_client()
325 !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, in nfs_match_client()
329 refcount_inc(&clp->cl_count); in nfs_match_client()
330 return clp; in nfs_match_client()
340 bool nfs_client_init_is_complete(const struct nfs_client *clp) in nfs_client_init_is_complete() argument
342 return clp->cl_cons_state <= NFS_CS_READY; in nfs_client_init_is_complete()
352 int nfs_client_init_status(const struct nfs_client *clp) in nfs_client_init_status() argument
355 if (clp->cl_cons_state > NFS_CS_READY) { in nfs_client_init_status()
359 return clp->cl_cons_state; in nfs_client_init_status()
363 int nfs_wait_client_init_complete(const struct nfs_client *clp) in nfs_wait_client_init_complete() argument
366 nfs_client_init_is_complete(clp)); in nfs_wait_client_init_complete()
375 struct nfs_client *clp) in nfs_found_client() argument
379 error = nfs_wait_client_init_complete(clp); in nfs_found_client()
381 nfs_put_client(clp); in nfs_found_client()
385 if (clp->cl_cons_state < NFS_CS_READY) { in nfs_found_client()
386 error = clp->cl_cons_state; in nfs_found_client()
387 nfs_put_client(clp); in nfs_found_client()
392 return clp; in nfs_found_client()
401 struct nfs_client *clp, *new = NULL; in nfs_get_client() local
414 clp = nfs_match_client(cl_init); in nfs_get_client()
415 if (clp) { in nfs_get_client()
419 if (IS_ERR(clp)) in nfs_get_client()
420 return clp; in nfs_get_client()
421 return nfs_found_client(cl_init, clp); in nfs_get_client()
442 void nfs_mark_client_ready(struct nfs_client *clp, int state) in nfs_mark_client_ready() argument
445 clp->cl_cons_state = state; in nfs_mark_client_ready()
495 int nfs_create_rpc_client(struct nfs_client *clp, in nfs_create_rpc_client() argument
501 .net = clp->cl_net, in nfs_create_rpc_client()
502 .protocol = clp->cl_proto, in nfs_create_rpc_client()
503 .nconnect = clp->cl_nconnect, in nfs_create_rpc_client()
504 .address = (struct sockaddr *)&clp->cl_addr, in nfs_create_rpc_client()
505 .addrsize = clp->cl_addrlen, in nfs_create_rpc_client()
507 .servername = clp->cl_hostname, in nfs_create_rpc_client()
510 .version = clp->rpc_ops->version, in nfs_create_rpc_client()
515 if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) in nfs_create_rpc_client()
517 if (test_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags)) in nfs_create_rpc_client()
519 if (test_bit(NFS_CS_NORESVPORT, &clp->cl_flags)) in nfs_create_rpc_client()
521 if (test_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags)) in nfs_create_rpc_client()
523 if (test_bit(NFS_CS_NOPING, &clp->cl_flags)) in nfs_create_rpc_client()
525 if (test_bit(NFS_CS_REUSEPORT, &clp->cl_flags)) in nfs_create_rpc_client()
528 if (!IS_ERR(clp->cl_rpcclient)) in nfs_create_rpc_client()
538 clnt->cl_principal = clp->cl_principal; in nfs_create_rpc_client()
539 clp->cl_rpcclient = clnt; in nfs_create_rpc_client()
540 clnt->cl_max_connect = clp->cl_max_connect; in nfs_create_rpc_client()
560 struct nfs_client *clp = server->nfs_client; in nfs_start_lockd() local
562 .hostname = clp->cl_hostname, in nfs_start_lockd()
563 .address = (struct sockaddr *)&clp->cl_addr, in nfs_start_lockd()
564 .addrlen = clp->cl_addrlen, in nfs_start_lockd()
565 .nfs_version = clp->rpc_ops->version, in nfs_start_lockd()
568 .net = clp->cl_net, in nfs_start_lockd()
569 .nlmclnt_ops = clp->cl_nfs_mod->rpc_ops->nlmclnt_ops, in nfs_start_lockd()
579 switch (clp->cl_proto) { in nfs_start_lockd()
605 struct nfs_client *clp = server->nfs_client; in nfs_init_server_rpcclient() local
607 server->client = rpc_clone_client_set_auth(clp->cl_rpcclient, in nfs_init_server_rpcclient()
636 struct nfs_client *nfs_init_client(struct nfs_client *clp, in nfs_init_client() argument
642 if (clp->cl_cons_state == NFS_CS_READY) in nfs_init_client()
643 return clp; in nfs_init_client()
649 error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); in nfs_init_client()
650 nfs_mark_client_ready(clp, error == 0 ? NFS_CS_READY : error); in nfs_init_client()
652 nfs_put_client(clp); in nfs_init_client()
653 clp = ERR_PTR(error); in nfs_init_client()
655 return clp; in nfs_init_client()
679 struct nfs_client *clp; in nfs_init_server() local
688 clp = nfs_get_client(&cl_init); in nfs_init_server()
689 if (IS_ERR(clp)) in nfs_init_server()
690 return PTR_ERR(clp); in nfs_init_server()
692 server->nfs_client = clp; in nfs_init_server()
699 switch (clp->rpc_ops->version) { in nfs_init_server()
711 server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto); in nfs_init_server()
713 server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto); in nfs_init_server()
748 nfs_put_client(clp); in nfs_init_server()
758 struct nfs_client *clp = server->nfs_client; in nfs_server_set_fsinfo() local
763 server->rsize = nfs_io_size(fsinfo->rtpref, clp->cl_proto); in nfs_server_set_fsinfo()
765 server->wsize = nfs_io_size(fsinfo->wtpref, clp->cl_proto); in nfs_server_set_fsinfo()
768 server->rsize = nfs_io_size(fsinfo->rtmax, clp->cl_proto); in nfs_server_set_fsinfo()
770 server->wsize = nfs_io_size(fsinfo->wtmax, clp->cl_proto); in nfs_server_set_fsinfo()
831 struct nfs_client *clp = server->nfs_client; in nfs_probe_fsinfo() local
834 if (clp->rpc_ops->set_capabilities != NULL) { in nfs_probe_fsinfo()
835 error = clp->rpc_ops->set_capabilities(server, mntfh); in nfs_probe_fsinfo()
843 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo); in nfs_probe_fsinfo()
856 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) in nfs_probe_fsinfo()
860 if (clp->rpc_ops->discover_trunking != NULL && in nfs_probe_fsinfo()
863 error = clp->rpc_ops->discover_trunking(server, mntfh); in nfs_probe_fsinfo()
916 struct nfs_client *clp = server->nfs_client; in nfs_server_insert_lists() local
917 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_insert_lists()
920 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks); in nfs_server_insert_lists()
922 clear_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_insert_lists()
930 struct nfs_client *clp = server->nfs_client; in nfs_server_remove_lists() local
933 if (clp == NULL) in nfs_server_remove_lists()
935 nn = net_generic(clp->cl_net, nfs_net_id); in nfs_server_remove_lists()
938 if (list_empty(&clp->cl_superblocks)) in nfs_server_remove_lists()
939 set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); in nfs_server_remove_lists()
1223 struct nfs_client *clp; in nfs_server_list_show() local
1233 clp = list_entry(v, struct nfs_client, cl_share_link); in nfs_server_list_show()
1236 if (clp->cl_cons_state != NFS_CS_READY) in nfs_server_list_show()
1241 clp->rpc_ops->version, in nfs_server_list_show()
1242 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_server_list_show()
1243 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_server_list_show()
1244 refcount_read(&clp->cl_count), in nfs_server_list_show()
1245 clp->cl_hostname); in nfs_server_list_show()
1291 struct nfs_client *clp; in nfs_volume_list_show() local
1304 clp = server->nfs_client; in nfs_volume_list_show()
1315 clp->rpc_ops->version, in nfs_volume_list_show()
1316 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), in nfs_volume_list_show()
1317 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), in nfs_volume_list_show()