• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/fs/nfs/

Lines Matching refs:clp

104 	struct nfs_client *clp;
107 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
116 __set_bit(NFS_CS_RPCIOD, &clp->cl_res_state);
121 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
124 atomic_set(&clp->cl_count, 1);
125 clp->cl_cons_state = NFS_CS_INITING;
127 clp->cl_nfsversion = nfsversion;
128 memcpy(&clp->cl_addr, addr, sizeof(clp->cl_addr));
131 clp->cl_hostname = kstrdup(hostname, GFP_KERNEL);
132 if (!clp->cl_hostname)
136 INIT_LIST_HEAD(&clp->cl_superblocks);
137 clp->cl_rpcclient = ERR_PTR(-EINVAL);
140 init_rwsem(&clp->cl_sem);
141 INIT_LIST_HEAD(&clp->cl_delegations);
142 INIT_LIST_HEAD(&clp->cl_state_owners);
143 INIT_LIST_HEAD(&clp->cl_unused);
144 spin_lock_init(&clp->cl_lock);
145 INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
146 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
147 clp->cl_boot_time = CURRENT_TIME;
148 clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
151 return clp;
154 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
158 __clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state);
160 kfree(clp);
165 static void nfs4_shutdown_client(struct nfs_client *clp)
168 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
169 nfs4_kill_renewd(clp);
170 while (!list_empty(&clp->cl_unused)) {
173 sp = list_entry(clp->cl_unused.next,
179 BUG_ON(!list_empty(&clp->cl_state_owners));
180 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
181 nfs_idmap_delete(clp);
188 static void nfs_free_client(struct nfs_client *clp)
190 dprintk("--> nfs_free_client(%d)\n", clp->cl_nfsversion);
192 nfs4_shutdown_client(clp);
195 if (!IS_ERR(clp->cl_rpcclient))
196 rpc_shutdown_client(clp->cl_rpcclient);
198 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
201 if (__test_and_clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state))
204 kfree(clp->cl_hostname);
205 kfree(clp);
213 void nfs_put_client(struct nfs_client *clp)
215 if (!clp)
218 dprintk("--> nfs_put_client({%d})\n", atomic_read(&clp->cl_count));
220 if (atomic_dec_and_lock(&clp->cl_count, &nfs_client_lock)) {
221 list_del(&clp->cl_share_link);
224 BUG_ON(!list_empty(&clp->cl_superblocks));
226 nfs_free_client(clp);
236 struct nfs_client *clp;
238 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
240 if (clp->cl_cons_state < 0)
244 if (clp->cl_nfsversion != nfsversion)
247 if (memcmp(&clp->cl_addr.sin_addr, &addr->sin_addr,
248 sizeof(clp->cl_addr.sin_addr)) != 0)
251 if (!match_port || clp->cl_addr.sin_port == addr->sin_port)
258 atomic_inc(&clp->cl_count);
259 return clp;
268 struct nfs_client *clp;
271 clp = __nfs_find_client(addr, nfsversion, 0);
273 if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) {
274 nfs_put_client(clp);
275 clp = NULL;
277 return clp;
288 struct nfs_client *clp, *new = NULL;
299 clp = __nfs_find_client(addr, nfsversion, 1);
300 if (clp)
314 clp = new;
315 list_add(&clp->cl_share_link, &nfs_client_list);
317 dprintk("--> nfs_get_client() = %p [new]\n", clp);
318 return clp;
330 clp->cl_cons_state != NFS_CS_INITING);
332 nfs_put_client(clp);
336 if (clp->cl_cons_state < NFS_CS_READY) {
337 error = clp->cl_cons_state;
338 nfs_put_client(clp);
342 BUG_ON(clp->cl_cons_state != NFS_CS_READY);
344 dprintk("--> nfs_get_client() = %p [share]\n", clp);
345 return clp;
351 static void nfs_mark_client_ready(struct nfs_client *clp, int state)
353 clp->cl_cons_state = state;
393 static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
403 .address = (struct sockaddr *)&clp->cl_addr,
404 .addrsize = sizeof(clp->cl_addr),
406 .servername = clp->cl_hostname,
408 .version = clp->rpc_ops->version,
413 if (!IS_ERR(clp->cl_rpcclient))
417 clp->retrans_timeo = timeparms.to_initval;
418 clp->retrans_count = timeparms.to_retries;
427 clp->cl_rpcclient = clnt;
499 struct nfs_client *clp = server->nfs_client;
501 server->client = rpc_clone_client(clp->cl_rpcclient);
507 if (pseudoflavour != clp->cl_rpcclient->cl_auth->au_flavor) {
530 static int nfs_init_client(struct nfs_client *clp, const struct nfs_mount_data *data)
535 if (clp->cl_cons_state == NFS_CS_READY) {
537 dprintk("<-- nfs_init_client() = 0 [already %p]\n", clp);
542 clp->rpc_ops = &nfs_v2_clientops;
544 if (clp->cl_nfsversion == 3)
545 clp->rpc_ops = &nfs_v3_clientops;
551 error = nfs_create_rpc_client(clp, proto, data->timeo, data->retrans,
555 nfs_mark_client_ready(clp, NFS_CS_READY);
559 nfs_mark_client_ready(clp, error);
569 struct nfs_client *clp;
580 clp = nfs_get_client(data->hostname, &data->addr, nfsvers);
581 if (IS_ERR(clp)) {
582 dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
583 return PTR_ERR(clp);
586 error = nfs_init_client(clp, data);
590 server->nfs_client = clp;
617 if (clp->cl_nfsversion == 3) {
627 dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp);
632 nfs_put_client(clp);
693 struct nfs_client *clp = server->nfs_client;
698 if (clp->rpc_ops->set_capabilities != NULL) {
699 error = clp->rpc_ops->set_capabilities(server, mntfh);
706 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo);
719 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0)
857 static int nfs4_init_client(struct nfs_client *clp,
864 if (clp->cl_cons_state == NFS_CS_READY) {
866 dprintk("<-- nfs4_init_client() = 0 [already %p]\n", clp);
871 clp->rpc_ops = &nfs_v4_clientops;
873 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
877 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
879 error = nfs_idmap_new(clp);
885 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
887 nfs_mark_client_ready(clp, NFS_CS_READY);
891 nfs_mark_client_ready(clp, error);
905 struct nfs_client *clp;
911 clp = nfs_get_client(hostname, addr, 4);
912 if (IS_ERR(clp)) {
913 error = PTR_ERR(clp);
916 error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour);
920 server->nfs_client = clp;
921 dprintk("<-- nfs4_set_client() = 0 [new %p]\n", clp);
925 nfs_put_client(clp);
1282 struct nfs_client *clp;
1291 clp = list_entry(v, struct nfs_client, cl_share_link);
1294 clp->cl_nfsversion,
1295 NIPQUAD(clp->cl_addr.sin_addr),
1296 ntohs(clp->cl_addr.sin_port),
1297 atomic_read(&clp->cl_count),
1298 clp->cl_hostname);
1374 struct nfs_client *clp;
1384 clp = server->nfs_client;
1394 clp->cl_nfsversion,
1395 NIPQUAD(clp->cl_addr.sin_addr),
1396 ntohs(clp->cl_addr.sin_port),