]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - fs/nfs/client.c
NFS: Clean up the nfs_find_client function.
[mirror_ubuntu-bionic-kernel.git] / fs / nfs / client.c
1 /* client.c: NFS client sharing and management code
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/sched.h>
16 #include <linux/time.h>
17 #include <linux/kernel.h>
18 #include <linux/mm.h>
19 #include <linux/string.h>
20 #include <linux/stat.h>
21 #include <linux/errno.h>
22 #include <linux/unistd.h>
23 #include <linux/sunrpc/clnt.h>
24 #include <linux/sunrpc/stats.h>
25 #include <linux/sunrpc/metrics.h>
26 #include <linux/sunrpc/xprtsock.h>
27 #include <linux/sunrpc/xprtrdma.h>
28 #include <linux/nfs_fs.h>
29 #include <linux/nfs_mount.h>
30 #include <linux/nfs4_mount.h>
31 #include <linux/lockd/bind.h>
32 #include <linux/seq_file.h>
33 #include <linux/mount.h>
34 #include <linux/nfs_idmap.h>
35 #include <linux/vfs.h>
36 #include <linux/inet.h>
37 #include <linux/nfs_xdr.h>
38
39 #include <asm/system.h>
40
41 #include "nfs4_fs.h"
42 #include "callback.h"
43 #include "delegation.h"
44 #include "iostat.h"
45 #include "internal.h"
46
47 #define NFSDBG_FACILITY NFSDBG_CLIENT
48
49 static DEFINE_SPINLOCK(nfs_client_lock);
50 static LIST_HEAD(nfs_client_list);
51 static LIST_HEAD(nfs_volume_list);
52 static DECLARE_WAIT_QUEUE_HEAD(nfs_client_active_wq);
53
54 /*
55 * RPC cruft for NFS
56 */
57 static struct rpc_version *nfs_version[5] = {
58 [2] = &nfs_version2,
59 #ifdef CONFIG_NFS_V3
60 [3] = &nfs_version3,
61 #endif
62 #ifdef CONFIG_NFS_V4
63 [4] = &nfs_version4,
64 #endif
65 };
66
67 struct rpc_program nfs_program = {
68 .name = "nfs",
69 .number = NFS_PROGRAM,
70 .nrvers = ARRAY_SIZE(nfs_version),
71 .version = nfs_version,
72 .stats = &nfs_rpcstat,
73 .pipe_dir_name = "/nfs",
74 };
75
76 struct rpc_stat nfs_rpcstat = {
77 .program = &nfs_program
78 };
79
80
81 #ifdef CONFIG_NFS_V3_ACL
82 static struct rpc_stat nfsacl_rpcstat = { &nfsacl_program };
83 static struct rpc_version * nfsacl_version[] = {
84 [3] = &nfsacl_version3,
85 };
86
87 struct rpc_program nfsacl_program = {
88 .name = "nfsacl",
89 .number = NFS_ACL_PROGRAM,
90 .nrvers = ARRAY_SIZE(nfsacl_version),
91 .version = nfsacl_version,
92 .stats = &nfsacl_rpcstat,
93 };
94 #endif /* CONFIG_NFS_V3_ACL */
95
96 struct nfs_client_initdata {
97 const char *hostname;
98 const struct sockaddr_in *addr;
99 int version;
100 };
101
102 /*
103 * Allocate a shared client record
104 *
105 * Since these are allocated/deallocated very rarely, we don't
106 * bother putting them in a slab cache...
107 */
108 static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
109 {
110 struct nfs_client *clp;
111
112 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
113 goto error_0;
114
115 if (cl_init->version == 4) {
116 if (nfs_callback_up() < 0)
117 goto error_2;
118 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
119 }
120
121 atomic_set(&clp->cl_count, 1);
122 clp->cl_cons_state = NFS_CS_INITING;
123
124 clp->cl_nfsversion = cl_init->version;
125 memcpy(&clp->cl_addr, cl_init->addr, sizeof(clp->cl_addr));
126
127 if (cl_init->hostname) {
128 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL);
129 if (!clp->cl_hostname)
130 goto error_3;
131 }
132
133 INIT_LIST_HEAD(&clp->cl_superblocks);
134 clp->cl_rpcclient = ERR_PTR(-EINVAL);
135
136 #ifdef CONFIG_NFS_V4
137 init_rwsem(&clp->cl_sem);
138 INIT_LIST_HEAD(&clp->cl_delegations);
139 spin_lock_init(&clp->cl_lock);
140 INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
141 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
142 clp->cl_boot_time = CURRENT_TIME;
143 clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
144 #endif
145
146 return clp;
147
148 error_3:
149 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
150 nfs_callback_down();
151 error_2:
152 kfree(clp);
153 error_0:
154 return NULL;
155 }
156
157 static void nfs4_shutdown_client(struct nfs_client *clp)
158 {
159 #ifdef CONFIG_NFS_V4
160 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
161 nfs4_kill_renewd(clp);
162 BUG_ON(!RB_EMPTY_ROOT(&clp->cl_state_owners));
163 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
164 nfs_idmap_delete(clp);
165 #endif
166 }
167
168 /*
169 * Destroy a shared client record
170 */
171 static void nfs_free_client(struct nfs_client *clp)
172 {
173 dprintk("--> nfs_free_client(%d)\n", clp->cl_nfsversion);
174
175 nfs4_shutdown_client(clp);
176
177 /* -EIO all pending I/O */
178 if (!IS_ERR(clp->cl_rpcclient))
179 rpc_shutdown_client(clp->cl_rpcclient);
180
181 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
182 nfs_callback_down();
183
184 kfree(clp->cl_hostname);
185 kfree(clp);
186
187 dprintk("<-- nfs_free_client()\n");
188 }
189
190 /*
191 * Release a reference to a shared client record
192 */
193 void nfs_put_client(struct nfs_client *clp)
194 {
195 if (!clp)
196 return;
197
198 dprintk("--> nfs_put_client({%d})\n", atomic_read(&clp->cl_count));
199
200 if (atomic_dec_and_lock(&clp->cl_count, &nfs_client_lock)) {
201 list_del(&clp->cl_share_link);
202 spin_unlock(&nfs_client_lock);
203
204 BUG_ON(!list_empty(&clp->cl_superblocks));
205
206 nfs_free_client(clp);
207 }
208 }
209
210 /*
211 * Find a client by IP address and protocol version
212 * - returns NULL if no such client
213 */
214 struct nfs_client *nfs_find_client(const struct sockaddr_in *addr, int nfsversion)
215 {
216 struct nfs_client *clp;
217
218 spin_lock(&nfs_client_lock);
219 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
220 /* Don't match clients that failed to initialise properly */
221 if (clp->cl_cons_state != NFS_CS_READY)
222 continue;
223
224 /* Different NFS versions cannot share the same nfs_client */
225 if (clp->cl_nfsversion != nfsversion)
226 continue;
227
228 /* Match only the IP address, not the port number */
229 if (clp->cl_addr.sin_addr.s_addr != addr->sin_addr.s_addr)
230 continue;
231
232 atomic_inc(&clp->cl_count);
233 spin_unlock(&nfs_client_lock);
234 return clp;
235 }
236 spin_unlock(&nfs_client_lock);
237 return NULL;
238 }
239
240 /*
241 * Find an nfs_client on the list that matches the initialisation data
242 * that is supplied.
243 */
244 static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *data)
245 {
246 struct nfs_client *clp;
247
248 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
249 /* Don't match clients that failed to initialise properly */
250 if (clp->cl_cons_state < 0)
251 continue;
252
253 /* Different NFS versions cannot share the same nfs_client */
254 if (clp->cl_nfsversion != data->version)
255 continue;
256
257 /* Match the full socket address */
258 if (memcmp(&clp->cl_addr, data->addr, sizeof(clp->cl_addr)) != 0)
259 continue;
260
261 atomic_inc(&clp->cl_count);
262 return clp;
263 }
264 return NULL;
265 }
266
267 /*
268 * Look up a client by IP address and protocol version
269 * - creates a new record if one doesn't yet exist
270 */
271 static struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init)
272 {
273 struct nfs_client *clp, *new = NULL;
274 int error;
275
276 dprintk("--> nfs_get_client(%s,"NIPQUAD_FMT":%d,%d)\n",
277 cl_init->hostname ?: "", NIPQUAD(cl_init->addr->sin_addr),
278 cl_init->addr->sin_port, cl_init->version);
279
280 /* see if the client already exists */
281 do {
282 spin_lock(&nfs_client_lock);
283
284 clp = nfs_match_client(cl_init);
285 if (clp)
286 goto found_client;
287 if (new)
288 goto install_client;
289
290 spin_unlock(&nfs_client_lock);
291
292 new = nfs_alloc_client(cl_init);
293 } while (new);
294
295 return ERR_PTR(-ENOMEM);
296
297 /* install a new client and return with it unready */
298 install_client:
299 clp = new;
300 list_add(&clp->cl_share_link, &nfs_client_list);
301 spin_unlock(&nfs_client_lock);
302 dprintk("--> nfs_get_client() = %p [new]\n", clp);
303 return clp;
304
305 /* found an existing client
306 * - make sure it's ready before returning
307 */
308 found_client:
309 spin_unlock(&nfs_client_lock);
310
311 if (new)
312 nfs_free_client(new);
313
314 error = wait_event_interruptible(nfs_client_active_wq,
315 clp->cl_cons_state != NFS_CS_INITING);
316 if (error < 0) {
317 nfs_put_client(clp);
318 return ERR_PTR(-ERESTARTSYS);
319 }
320
321 if (clp->cl_cons_state < NFS_CS_READY) {
322 error = clp->cl_cons_state;
323 nfs_put_client(clp);
324 return ERR_PTR(error);
325 }
326
327 BUG_ON(clp->cl_cons_state != NFS_CS_READY);
328
329 dprintk("--> nfs_get_client() = %p [share]\n", clp);
330 return clp;
331 }
332
333 /*
334 * Mark a server as ready or failed
335 */
336 static void nfs_mark_client_ready(struct nfs_client *clp, int state)
337 {
338 clp->cl_cons_state = state;
339 wake_up_all(&nfs_client_active_wq);
340 }
341
342 /*
343 * Initialise the timeout values for a connection
344 */
345 static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
346 unsigned int timeo, unsigned int retrans)
347 {
348 to->to_initval = timeo * HZ / 10;
349 to->to_retries = retrans;
350 if (!to->to_retries)
351 to->to_retries = 2;
352
353 switch (proto) {
354 case XPRT_TRANSPORT_TCP:
355 case XPRT_TRANSPORT_RDMA:
356 if (!to->to_initval)
357 to->to_initval = 60 * HZ;
358 if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
359 to->to_initval = NFS_MAX_TCP_TIMEOUT;
360 to->to_increment = to->to_initval;
361 to->to_maxval = to->to_initval + (to->to_increment * to->to_retries);
362 to->to_exponential = 0;
363 break;
364 case XPRT_TRANSPORT_UDP:
365 default:
366 if (!to->to_initval)
367 to->to_initval = 11 * HZ / 10;
368 if (to->to_initval > NFS_MAX_UDP_TIMEOUT)
369 to->to_initval = NFS_MAX_UDP_TIMEOUT;
370 to->to_maxval = NFS_MAX_UDP_TIMEOUT;
371 to->to_exponential = 1;
372 break;
373 }
374 }
375
376 /*
377 * Create an RPC client handle
378 */
379 static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
380 unsigned int timeo,
381 unsigned int retrans,
382 rpc_authflavor_t flavor,
383 int flags)
384 {
385 struct rpc_timeout timeparms;
386 struct rpc_clnt *clnt = NULL;
387 struct rpc_create_args args = {
388 .protocol = proto,
389 .address = (struct sockaddr *)&clp->cl_addr,
390 .addrsize = sizeof(clp->cl_addr),
391 .timeout = &timeparms,
392 .servername = clp->cl_hostname,
393 .program = &nfs_program,
394 .version = clp->rpc_ops->version,
395 .authflavor = flavor,
396 .flags = flags,
397 };
398
399 if (!IS_ERR(clp->cl_rpcclient))
400 return 0;
401
402 nfs_init_timeout_values(&timeparms, proto, timeo, retrans);
403 clp->retrans_timeo = timeparms.to_initval;
404 clp->retrans_count = timeparms.to_retries;
405
406 clnt = rpc_create(&args);
407 if (IS_ERR(clnt)) {
408 dprintk("%s: cannot create RPC client. Error = %ld\n",
409 __FUNCTION__, PTR_ERR(clnt));
410 return PTR_ERR(clnt);
411 }
412
413 clp->cl_rpcclient = clnt;
414 return 0;
415 }
416
417 /*
418 * Version 2 or 3 client destruction
419 */
420 static void nfs_destroy_server(struct nfs_server *server)
421 {
422 if (!(server->flags & NFS_MOUNT_NONLM))
423 lockd_down(); /* release rpc.lockd */
424 }
425
426 /*
427 * Version 2 or 3 lockd setup
428 */
429 static int nfs_start_lockd(struct nfs_server *server)
430 {
431 int error = 0;
432
433 if (server->nfs_client->cl_nfsversion > 3)
434 goto out;
435 if (server->flags & NFS_MOUNT_NONLM)
436 goto out;
437 error = lockd_up((server->flags & NFS_MOUNT_TCP) ?
438 IPPROTO_TCP : IPPROTO_UDP);
439 if (error < 0)
440 server->flags |= NFS_MOUNT_NONLM;
441 else
442 server->destroy = nfs_destroy_server;
443 out:
444 return error;
445 }
446
447 /*
448 * Initialise an NFSv3 ACL client connection
449 */
450 #ifdef CONFIG_NFS_V3_ACL
451 static void nfs_init_server_aclclient(struct nfs_server *server)
452 {
453 if (server->nfs_client->cl_nfsversion != 3)
454 goto out_noacl;
455 if (server->flags & NFS_MOUNT_NOACL)
456 goto out_noacl;
457
458 server->client_acl = rpc_bind_new_program(server->client, &nfsacl_program, 3);
459 if (IS_ERR(server->client_acl))
460 goto out_noacl;
461
462 /* No errors! Assume that Sun nfsacls are supported */
463 server->caps |= NFS_CAP_ACLS;
464 return;
465
466 out_noacl:
467 server->caps &= ~NFS_CAP_ACLS;
468 }
469 #else
470 static inline void nfs_init_server_aclclient(struct nfs_server *server)
471 {
472 server->flags &= ~NFS_MOUNT_NOACL;
473 server->caps &= ~NFS_CAP_ACLS;
474 }
475 #endif
476
477 /*
478 * Create a general RPC client
479 */
480 static int nfs_init_server_rpcclient(struct nfs_server *server, rpc_authflavor_t pseudoflavour)
481 {
482 struct nfs_client *clp = server->nfs_client;
483
484 server->client = rpc_clone_client(clp->cl_rpcclient);
485 if (IS_ERR(server->client)) {
486 dprintk("%s: couldn't create rpc_client!\n", __FUNCTION__);
487 return PTR_ERR(server->client);
488 }
489
490 if (pseudoflavour != clp->cl_rpcclient->cl_auth->au_flavor) {
491 struct rpc_auth *auth;
492
493 auth = rpcauth_create(pseudoflavour, server->client);
494 if (IS_ERR(auth)) {
495 dprintk("%s: couldn't create credcache!\n", __FUNCTION__);
496 return PTR_ERR(auth);
497 }
498 }
499 server->client->cl_softrtry = 0;
500 if (server->flags & NFS_MOUNT_SOFT)
501 server->client->cl_softrtry = 1;
502
503 server->client->cl_intr = 0;
504 if (server->flags & NFS4_MOUNT_INTR)
505 server->client->cl_intr = 1;
506
507 return 0;
508 }
509
510 /*
511 * Initialise an NFS2 or NFS3 client
512 */
513 static int nfs_init_client(struct nfs_client *clp,
514 const struct nfs_parsed_mount_data *data)
515 {
516 int error;
517
518 if (clp->cl_cons_state == NFS_CS_READY) {
519 /* the client is already initialised */
520 dprintk("<-- nfs_init_client() = 0 [already %p]\n", clp);
521 return 0;
522 }
523
524 /* Check NFS protocol revision and initialize RPC op vector */
525 clp->rpc_ops = &nfs_v2_clientops;
526 #ifdef CONFIG_NFS_V3
527 if (clp->cl_nfsversion == 3)
528 clp->rpc_ops = &nfs_v3_clientops;
529 #endif
530 /*
531 * Create a client RPC handle for doing FSSTAT with UNIX auth only
532 * - RFC 2623, sec 2.3.2
533 */
534 error = nfs_create_rpc_client(clp, data->nfs_server.protocol,
535 data->timeo, data->retrans, RPC_AUTH_UNIX, 0);
536 if (error < 0)
537 goto error;
538 nfs_mark_client_ready(clp, NFS_CS_READY);
539 return 0;
540
541 error:
542 nfs_mark_client_ready(clp, error);
543 dprintk("<-- nfs_init_client() = xerror %d\n", error);
544 return error;
545 }
546
547 /*
548 * Create a version 2 or 3 client
549 */
550 static int nfs_init_server(struct nfs_server *server,
551 const struct nfs_parsed_mount_data *data)
552 {
553 struct nfs_client_initdata cl_init = {
554 .hostname = data->nfs_server.hostname,
555 .addr = &data->nfs_server.address,
556 .version = 2,
557 };
558 struct nfs_client *clp;
559 int error;
560
561 dprintk("--> nfs_init_server()\n");
562
563 #ifdef CONFIG_NFS_V3
564 if (data->flags & NFS_MOUNT_VER3)
565 cl_init.version = 3;
566 #endif
567
568 /* Allocate or find a client reference we can use */
569 clp = nfs_get_client(&cl_init);
570 if (IS_ERR(clp)) {
571 dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
572 return PTR_ERR(clp);
573 }
574
575 error = nfs_init_client(clp, data);
576 if (error < 0)
577 goto error;
578
579 server->nfs_client = clp;
580
581 /* Initialise the client representation from the mount data */
582 server->flags = data->flags & NFS_MOUNT_FLAGMASK;
583
584 if (data->rsize)
585 server->rsize = nfs_block_size(data->rsize, NULL);
586 if (data->wsize)
587 server->wsize = nfs_block_size(data->wsize, NULL);
588
589 server->acregmin = data->acregmin * HZ;
590 server->acregmax = data->acregmax * HZ;
591 server->acdirmin = data->acdirmin * HZ;
592 server->acdirmax = data->acdirmax * HZ;
593
594 /* Start lockd here, before we might error out */
595 error = nfs_start_lockd(server);
596 if (error < 0)
597 goto error;
598
599 error = nfs_init_server_rpcclient(server, data->auth_flavors[0]);
600 if (error < 0)
601 goto error;
602
603 server->namelen = data->namlen;
604 /* Create a client RPC handle for the NFSv3 ACL management interface */
605 nfs_init_server_aclclient(server);
606 dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp);
607 return 0;
608
609 error:
610 server->nfs_client = NULL;
611 nfs_put_client(clp);
612 dprintk("<-- nfs_init_server() = xerror %d\n", error);
613 return error;
614 }
615
616 /*
617 * Load up the server record from information gained in an fsinfo record
618 */
619 static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *fsinfo)
620 {
621 unsigned long max_rpc_payload;
622
623 /* Work out a lot of parameters */
624 if (server->rsize == 0)
625 server->rsize = nfs_block_size(fsinfo->rtpref, NULL);
626 if (server->wsize == 0)
627 server->wsize = nfs_block_size(fsinfo->wtpref, NULL);
628
629 if (fsinfo->rtmax >= 512 && server->rsize > fsinfo->rtmax)
630 server->rsize = nfs_block_size(fsinfo->rtmax, NULL);
631 if (fsinfo->wtmax >= 512 && server->wsize > fsinfo->wtmax)
632 server->wsize = nfs_block_size(fsinfo->wtmax, NULL);
633
634 max_rpc_payload = nfs_block_size(rpc_max_payload(server->client), NULL);
635 if (server->rsize > max_rpc_payload)
636 server->rsize = max_rpc_payload;
637 if (server->rsize > NFS_MAX_FILE_IO_SIZE)
638 server->rsize = NFS_MAX_FILE_IO_SIZE;
639 server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
640
641 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
642
643 if (server->wsize > max_rpc_payload)
644 server->wsize = max_rpc_payload;
645 if (server->wsize > NFS_MAX_FILE_IO_SIZE)
646 server->wsize = NFS_MAX_FILE_IO_SIZE;
647 server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
648 server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL);
649
650 server->dtsize = nfs_block_size(fsinfo->dtpref, NULL);
651 if (server->dtsize > PAGE_CACHE_SIZE)
652 server->dtsize = PAGE_CACHE_SIZE;
653 if (server->dtsize > server->rsize)
654 server->dtsize = server->rsize;
655
656 if (server->flags & NFS_MOUNT_NOAC) {
657 server->acregmin = server->acregmax = 0;
658 server->acdirmin = server->acdirmax = 0;
659 }
660
661 server->maxfilesize = fsinfo->maxfilesize;
662
663 /* We're airborne Set socket buffersize */
664 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100);
665 }
666
667 /*
668 * Probe filesystem information, including the FSID on v2/v3
669 */
670 static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fattr)
671 {
672 struct nfs_fsinfo fsinfo;
673 struct nfs_client *clp = server->nfs_client;
674 int error;
675
676 dprintk("--> nfs_probe_fsinfo()\n");
677
678 if (clp->rpc_ops->set_capabilities != NULL) {
679 error = clp->rpc_ops->set_capabilities(server, mntfh);
680 if (error < 0)
681 goto out_error;
682 }
683
684 fsinfo.fattr = fattr;
685 nfs_fattr_init(fattr);
686 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo);
687 if (error < 0)
688 goto out_error;
689
690 nfs_server_set_fsinfo(server, &fsinfo);
691 error = bdi_init(&server->backing_dev_info);
692 if (error)
693 goto out_error;
694
695
696 /* Get some general file system info */
697 if (server->namelen == 0) {
698 struct nfs_pathconf pathinfo;
699
700 pathinfo.fattr = fattr;
701 nfs_fattr_init(fattr);
702
703 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0)
704 server->namelen = pathinfo.max_namelen;
705 }
706
707 dprintk("<-- nfs_probe_fsinfo() = 0\n");
708 return 0;
709
710 out_error:
711 dprintk("nfs_probe_fsinfo: error = %d\n", -error);
712 return error;
713 }
714
715 /*
716 * Copy useful information when duplicating a server record
717 */
718 static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
719 {
720 target->flags = source->flags;
721 target->acregmin = source->acregmin;
722 target->acregmax = source->acregmax;
723 target->acdirmin = source->acdirmin;
724 target->acdirmax = source->acdirmax;
725 target->caps = source->caps;
726 }
727
728 /*
729 * Allocate and initialise a server record
730 */
731 static struct nfs_server *nfs_alloc_server(void)
732 {
733 struct nfs_server *server;
734
735 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL);
736 if (!server)
737 return NULL;
738
739 server->client = server->client_acl = ERR_PTR(-EINVAL);
740
741 /* Zero out the NFS state stuff */
742 INIT_LIST_HEAD(&server->client_link);
743 INIT_LIST_HEAD(&server->master_link);
744
745 init_waitqueue_head(&server->active_wq);
746 atomic_set(&server->active, 0);
747
748 server->io_stats = nfs_alloc_iostats();
749 if (!server->io_stats) {
750 kfree(server);
751 return NULL;
752 }
753
754 return server;
755 }
756
757 /*
758 * Free up a server record
759 */
760 void nfs_free_server(struct nfs_server *server)
761 {
762 dprintk("--> nfs_free_server()\n");
763
764 spin_lock(&nfs_client_lock);
765 list_del(&server->client_link);
766 list_del(&server->master_link);
767 spin_unlock(&nfs_client_lock);
768
769 if (server->destroy != NULL)
770 server->destroy(server);
771
772 if (!IS_ERR(server->client_acl))
773 rpc_shutdown_client(server->client_acl);
774 if (!IS_ERR(server->client))
775 rpc_shutdown_client(server->client);
776
777 nfs_put_client(server->nfs_client);
778
779 nfs_free_iostats(server->io_stats);
780 bdi_destroy(&server->backing_dev_info);
781 kfree(server);
782 nfs_release_automount_timer();
783 dprintk("<-- nfs_free_server()\n");
784 }
785
786 /*
787 * Create a version 2 or 3 volume record
788 * - keyed on server and FSID
789 */
790 struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
791 struct nfs_fh *mntfh)
792 {
793 struct nfs_server *server;
794 struct nfs_fattr fattr;
795 int error;
796
797 server = nfs_alloc_server();
798 if (!server)
799 return ERR_PTR(-ENOMEM);
800
801 /* Get a client representation */
802 error = nfs_init_server(server, data);
803 if (error < 0)
804 goto error;
805
806 BUG_ON(!server->nfs_client);
807 BUG_ON(!server->nfs_client->rpc_ops);
808 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
809
810 /* Probe the root fh to retrieve its FSID */
811 error = nfs_probe_fsinfo(server, mntfh, &fattr);
812 if (error < 0)
813 goto error;
814 if (server->nfs_client->rpc_ops->version == 3) {
815 if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN)
816 server->namelen = NFS3_MAXNAMLEN;
817 if (!(data->flags & NFS_MOUNT_NORDIRPLUS))
818 server->caps |= NFS_CAP_READDIRPLUS;
819 } else {
820 if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN)
821 server->namelen = NFS2_MAXNAMLEN;
822 }
823
824 if (!(fattr.valid & NFS_ATTR_FATTR)) {
825 error = server->nfs_client->rpc_ops->getattr(server, mntfh, &fattr);
826 if (error < 0) {
827 dprintk("nfs_create_server: getattr error = %d\n", -error);
828 goto error;
829 }
830 }
831 memcpy(&server->fsid, &fattr.fsid, sizeof(server->fsid));
832
833 dprintk("Server FSID: %llx:%llx\n",
834 (unsigned long long) server->fsid.major,
835 (unsigned long long) server->fsid.minor);
836
837 BUG_ON(!server->nfs_client);
838 BUG_ON(!server->nfs_client->rpc_ops);
839 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
840
841 spin_lock(&nfs_client_lock);
842 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
843 list_add_tail(&server->master_link, &nfs_volume_list);
844 spin_unlock(&nfs_client_lock);
845
846 server->mount_time = jiffies;
847 return server;
848
849 error:
850 nfs_free_server(server);
851 return ERR_PTR(error);
852 }
853
854 #ifdef CONFIG_NFS_V4
855 /*
856 * Initialise an NFS4 client record
857 */
858 static int nfs4_init_client(struct nfs_client *clp,
859 int proto, int timeo, int retrans,
860 const char *ip_addr,
861 rpc_authflavor_t authflavour)
862 {
863 int error;
864
865 if (clp->cl_cons_state == NFS_CS_READY) {
866 /* the client is initialised already */
867 dprintk("<-- nfs4_init_client() = 0 [already %p]\n", clp);
868 return 0;
869 }
870
871 /* Check NFS protocol revision and initialize RPC op vector */
872 clp->rpc_ops = &nfs_v4_clientops;
873
874 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
875 RPC_CLNT_CREATE_DISCRTRY);
876 if (error < 0)
877 goto error;
878 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
879
880 error = nfs_idmap_new(clp);
881 if (error < 0) {
882 dprintk("%s: failed to create idmapper. Error = %d\n",
883 __FUNCTION__, error);
884 goto error;
885 }
886 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
887
888 nfs_mark_client_ready(clp, NFS_CS_READY);
889 return 0;
890
891 error:
892 nfs_mark_client_ready(clp, error);
893 dprintk("<-- nfs4_init_client() = xerror %d\n", error);
894 return error;
895 }
896
897 /*
898 * Set up an NFS4 client
899 */
900 static int nfs4_set_client(struct nfs_server *server,
901 const char *hostname, const struct sockaddr_in *addr,
902 const char *ip_addr,
903 rpc_authflavor_t authflavour,
904 int proto, int timeo, int retrans)
905 {
906 struct nfs_client_initdata cl_init = {
907 .hostname = hostname,
908 .addr = addr,
909 .version = 4,
910 };
911 struct nfs_client *clp;
912 int error;
913
914 dprintk("--> nfs4_set_client()\n");
915
916 /* Allocate or find a client reference we can use */
917 clp = nfs_get_client(&cl_init);
918 if (IS_ERR(clp)) {
919 error = PTR_ERR(clp);
920 goto error;
921 }
922 error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour);
923 if (error < 0)
924 goto error_put;
925
926 server->nfs_client = clp;
927 dprintk("<-- nfs4_set_client() = 0 [new %p]\n", clp);
928 return 0;
929
930 error_put:
931 nfs_put_client(clp);
932 error:
933 dprintk("<-- nfs4_set_client() = xerror %d\n", error);
934 return error;
935 }
936
937 /*
938 * Create a version 4 volume record
939 */
940 static int nfs4_init_server(struct nfs_server *server,
941 const struct nfs_parsed_mount_data *data)
942 {
943 int error;
944
945 dprintk("--> nfs4_init_server()\n");
946
947 /* Initialise the client representation from the mount data */
948 server->flags = data->flags & NFS_MOUNT_FLAGMASK;
949 server->caps |= NFS_CAP_ATOMIC_OPEN;
950
951 if (data->rsize)
952 server->rsize = nfs_block_size(data->rsize, NULL);
953 if (data->wsize)
954 server->wsize = nfs_block_size(data->wsize, NULL);
955
956 server->acregmin = data->acregmin * HZ;
957 server->acregmax = data->acregmax * HZ;
958 server->acdirmin = data->acdirmin * HZ;
959 server->acdirmax = data->acdirmax * HZ;
960
961 error = nfs_init_server_rpcclient(server, data->auth_flavors[0]);
962
963 /* Done */
964 dprintk("<-- nfs4_init_server() = %d\n", error);
965 return error;
966 }
967
968 /*
969 * Create a version 4 volume record
970 * - keyed on server and FSID
971 */
972 struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
973 struct nfs_fh *mntfh)
974 {
975 struct nfs_fattr fattr;
976 struct nfs_server *server;
977 int error;
978
979 dprintk("--> nfs4_create_server()\n");
980
981 server = nfs_alloc_server();
982 if (!server)
983 return ERR_PTR(-ENOMEM);
984
985 /* Get a client record */
986 error = nfs4_set_client(server,
987 data->nfs_server.hostname,
988 &data->nfs_server.address,
989 data->client_address,
990 data->auth_flavors[0],
991 data->nfs_server.protocol,
992 data->timeo, data->retrans);
993 if (error < 0)
994 goto error;
995
996 /* set up the general RPC client */
997 error = nfs4_init_server(server, data);
998 if (error < 0)
999 goto error;
1000
1001 BUG_ON(!server->nfs_client);
1002 BUG_ON(!server->nfs_client->rpc_ops);
1003 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1004
1005 /* Probe the root fh to retrieve its FSID */
1006 error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path);
1007 if (error < 0)
1008 goto error;
1009
1010 dprintk("Server FSID: %llx:%llx\n",
1011 (unsigned long long) server->fsid.major,
1012 (unsigned long long) server->fsid.minor);
1013 dprintk("Mount FH: %d\n", mntfh->size);
1014
1015 error = nfs_probe_fsinfo(server, mntfh, &fattr);
1016 if (error < 0)
1017 goto error;
1018
1019 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1020 server->namelen = NFS4_MAXNAMLEN;
1021
1022 BUG_ON(!server->nfs_client);
1023 BUG_ON(!server->nfs_client->rpc_ops);
1024 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1025
1026 spin_lock(&nfs_client_lock);
1027 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1028 list_add_tail(&server->master_link, &nfs_volume_list);
1029 spin_unlock(&nfs_client_lock);
1030
1031 server->mount_time = jiffies;
1032 dprintk("<-- nfs4_create_server() = %p\n", server);
1033 return server;
1034
1035 error:
1036 nfs_free_server(server);
1037 dprintk("<-- nfs4_create_server() = error %d\n", error);
1038 return ERR_PTR(error);
1039 }
1040
1041 /*
1042 * Create an NFS4 referral server record
1043 */
1044 struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1045 struct nfs_fh *mntfh)
1046 {
1047 struct nfs_client *parent_client;
1048 struct nfs_server *server, *parent_server;
1049 struct nfs_fattr fattr;
1050 int error;
1051
1052 dprintk("--> nfs4_create_referral_server()\n");
1053
1054 server = nfs_alloc_server();
1055 if (!server)
1056 return ERR_PTR(-ENOMEM);
1057
1058 parent_server = NFS_SB(data->sb);
1059 parent_client = parent_server->nfs_client;
1060
1061 /* Get a client representation.
1062 * Note: NFSv4 always uses TCP, */
1063 error = nfs4_set_client(server, data->hostname, data->addr,
1064 parent_client->cl_ipaddr,
1065 data->authflavor,
1066 parent_server->client->cl_xprt->prot,
1067 parent_client->retrans_timeo,
1068 parent_client->retrans_count);
1069 if (error < 0)
1070 goto error;
1071
1072 /* Initialise the client representation from the parent server */
1073 nfs_server_copy_userdata(server, parent_server);
1074 server->caps |= NFS_CAP_ATOMIC_OPEN;
1075
1076 error = nfs_init_server_rpcclient(server, data->authflavor);
1077 if (error < 0)
1078 goto error;
1079
1080 BUG_ON(!server->nfs_client);
1081 BUG_ON(!server->nfs_client->rpc_ops);
1082 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1083
1084 /* Probe the root fh to retrieve its FSID and filehandle */
1085 error = nfs4_path_walk(server, mntfh, data->mnt_path);
1086 if (error < 0)
1087 goto error;
1088
1089 /* probe the filesystem info for this server filesystem */
1090 error = nfs_probe_fsinfo(server, mntfh, &fattr);
1091 if (error < 0)
1092 goto error;
1093
1094 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1095 server->namelen = NFS4_MAXNAMLEN;
1096
1097 dprintk("Referral FSID: %llx:%llx\n",
1098 (unsigned long long) server->fsid.major,
1099 (unsigned long long) server->fsid.minor);
1100
1101 spin_lock(&nfs_client_lock);
1102 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1103 list_add_tail(&server->master_link, &nfs_volume_list);
1104 spin_unlock(&nfs_client_lock);
1105
1106 server->mount_time = jiffies;
1107
1108 dprintk("<-- nfs_create_referral_server() = %p\n", server);
1109 return server;
1110
1111 error:
1112 nfs_free_server(server);
1113 dprintk("<-- nfs4_create_referral_server() = error %d\n", error);
1114 return ERR_PTR(error);
1115 }
1116
1117 #endif /* CONFIG_NFS_V4 */
1118
1119 /*
1120 * Clone an NFS2, NFS3 or NFS4 server record
1121 */
1122 struct nfs_server *nfs_clone_server(struct nfs_server *source,
1123 struct nfs_fh *fh,
1124 struct nfs_fattr *fattr)
1125 {
1126 struct nfs_server *server;
1127 struct nfs_fattr fattr_fsinfo;
1128 int error;
1129
1130 dprintk("--> nfs_clone_server(,%llx:%llx,)\n",
1131 (unsigned long long) fattr->fsid.major,
1132 (unsigned long long) fattr->fsid.minor);
1133
1134 server = nfs_alloc_server();
1135 if (!server)
1136 return ERR_PTR(-ENOMEM);
1137
1138 /* Copy data from the source */
1139 server->nfs_client = source->nfs_client;
1140 atomic_inc(&server->nfs_client->cl_count);
1141 nfs_server_copy_userdata(server, source);
1142
1143 server->fsid = fattr->fsid;
1144
1145 error = nfs_init_server_rpcclient(server, source->client->cl_auth->au_flavor);
1146 if (error < 0)
1147 goto out_free_server;
1148 if (!IS_ERR(source->client_acl))
1149 nfs_init_server_aclclient(server);
1150
1151 /* probe the filesystem info for this server filesystem */
1152 error = nfs_probe_fsinfo(server, fh, &fattr_fsinfo);
1153 if (error < 0)
1154 goto out_free_server;
1155
1156 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1157 server->namelen = NFS4_MAXNAMLEN;
1158
1159 dprintk("Cloned FSID: %llx:%llx\n",
1160 (unsigned long long) server->fsid.major,
1161 (unsigned long long) server->fsid.minor);
1162
1163 error = nfs_start_lockd(server);
1164 if (error < 0)
1165 goto out_free_server;
1166
1167 spin_lock(&nfs_client_lock);
1168 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1169 list_add_tail(&server->master_link, &nfs_volume_list);
1170 spin_unlock(&nfs_client_lock);
1171
1172 server->mount_time = jiffies;
1173
1174 dprintk("<-- nfs_clone_server() = %p\n", server);
1175 return server;
1176
1177 out_free_server:
1178 nfs_free_server(server);
1179 dprintk("<-- nfs_clone_server() = error %d\n", error);
1180 return ERR_PTR(error);
1181 }
1182
1183 #ifdef CONFIG_PROC_FS
1184 static struct proc_dir_entry *proc_fs_nfs;
1185
1186 static int nfs_server_list_open(struct inode *inode, struct file *file);
1187 static void *nfs_server_list_start(struct seq_file *p, loff_t *pos);
1188 static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos);
1189 static void nfs_server_list_stop(struct seq_file *p, void *v);
1190 static int nfs_server_list_show(struct seq_file *m, void *v);
1191
1192 static struct seq_operations nfs_server_list_ops = {
1193 .start = nfs_server_list_start,
1194 .next = nfs_server_list_next,
1195 .stop = nfs_server_list_stop,
1196 .show = nfs_server_list_show,
1197 };
1198
1199 static const struct file_operations nfs_server_list_fops = {
1200 .open = nfs_server_list_open,
1201 .read = seq_read,
1202 .llseek = seq_lseek,
1203 .release = seq_release,
1204 };
1205
1206 static int nfs_volume_list_open(struct inode *inode, struct file *file);
1207 static void *nfs_volume_list_start(struct seq_file *p, loff_t *pos);
1208 static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos);
1209 static void nfs_volume_list_stop(struct seq_file *p, void *v);
1210 static int nfs_volume_list_show(struct seq_file *m, void *v);
1211
1212 static struct seq_operations nfs_volume_list_ops = {
1213 .start = nfs_volume_list_start,
1214 .next = nfs_volume_list_next,
1215 .stop = nfs_volume_list_stop,
1216 .show = nfs_volume_list_show,
1217 };
1218
1219 static const struct file_operations nfs_volume_list_fops = {
1220 .open = nfs_volume_list_open,
1221 .read = seq_read,
1222 .llseek = seq_lseek,
1223 .release = seq_release,
1224 };
1225
1226 /*
1227 * open "/proc/fs/nfsfs/servers" which provides a summary of servers with which
1228 * we're dealing
1229 */
1230 static int nfs_server_list_open(struct inode *inode, struct file *file)
1231 {
1232 struct seq_file *m;
1233 int ret;
1234
1235 ret = seq_open(file, &nfs_server_list_ops);
1236 if (ret < 0)
1237 return ret;
1238
1239 m = file->private_data;
1240 m->private = PDE(inode)->data;
1241
1242 return 0;
1243 }
1244
1245 /*
1246 * set up the iterator to start reading from the server list and return the first item
1247 */
1248 static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos)
1249 {
1250 /* lock the list against modification */
1251 spin_lock(&nfs_client_lock);
1252 return seq_list_start_head(&nfs_client_list, *_pos);
1253 }
1254
1255 /*
1256 * move to next server
1257 */
1258 static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos)
1259 {
1260 return seq_list_next(v, &nfs_client_list, pos);
1261 }
1262
1263 /*
1264 * clean up after reading from the transports list
1265 */
1266 static void nfs_server_list_stop(struct seq_file *p, void *v)
1267 {
1268 spin_unlock(&nfs_client_lock);
1269 }
1270
1271 /*
1272 * display a header line followed by a load of call lines
1273 */
1274 static int nfs_server_list_show(struct seq_file *m, void *v)
1275 {
1276 struct nfs_client *clp;
1277
1278 /* display header on line 1 */
1279 if (v == &nfs_client_list) {
1280 seq_puts(m, "NV SERVER PORT USE HOSTNAME\n");
1281 return 0;
1282 }
1283
1284 /* display one transport per line on subsequent lines */
1285 clp = list_entry(v, struct nfs_client, cl_share_link);
1286
1287 seq_printf(m, "v%d %02x%02x%02x%02x %4hx %3d %s\n",
1288 clp->cl_nfsversion,
1289 NIPQUAD(clp->cl_addr.sin_addr),
1290 ntohs(clp->cl_addr.sin_port),
1291 atomic_read(&clp->cl_count),
1292 clp->cl_hostname);
1293
1294 return 0;
1295 }
1296
1297 /*
1298 * open "/proc/fs/nfsfs/volumes" which provides a summary of extant volumes
1299 */
1300 static int nfs_volume_list_open(struct inode *inode, struct file *file)
1301 {
1302 struct seq_file *m;
1303 int ret;
1304
1305 ret = seq_open(file, &nfs_volume_list_ops);
1306 if (ret < 0)
1307 return ret;
1308
1309 m = file->private_data;
1310 m->private = PDE(inode)->data;
1311
1312 return 0;
1313 }
1314
1315 /*
1316 * set up the iterator to start reading from the volume list and return the first item
1317 */
1318 static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos)
1319 {
1320 /* lock the list against modification */
1321 spin_lock(&nfs_client_lock);
1322 return seq_list_start_head(&nfs_volume_list, *_pos);
1323 }
1324
1325 /*
1326 * move to next volume
1327 */
1328 static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos)
1329 {
1330 return seq_list_next(v, &nfs_volume_list, pos);
1331 }
1332
1333 /*
1334 * clean up after reading from the transports list
1335 */
1336 static void nfs_volume_list_stop(struct seq_file *p, void *v)
1337 {
1338 spin_unlock(&nfs_client_lock);
1339 }
1340
1341 /*
1342 * display a header line followed by a load of call lines
1343 */
1344 static int nfs_volume_list_show(struct seq_file *m, void *v)
1345 {
1346 struct nfs_server *server;
1347 struct nfs_client *clp;
1348 char dev[8], fsid[17];
1349
1350 /* display header on line 1 */
1351 if (v == &nfs_volume_list) {
1352 seq_puts(m, "NV SERVER PORT DEV FSID\n");
1353 return 0;
1354 }
1355 /* display one transport per line on subsequent lines */
1356 server = list_entry(v, struct nfs_server, master_link);
1357 clp = server->nfs_client;
1358
1359 snprintf(dev, 8, "%u:%u",
1360 MAJOR(server->s_dev), MINOR(server->s_dev));
1361
1362 snprintf(fsid, 17, "%llx:%llx",
1363 (unsigned long long) server->fsid.major,
1364 (unsigned long long) server->fsid.minor);
1365
1366 seq_printf(m, "v%d %02x%02x%02x%02x %4hx %-7s %-17s\n",
1367 clp->cl_nfsversion,
1368 NIPQUAD(clp->cl_addr.sin_addr),
1369 ntohs(clp->cl_addr.sin_port),
1370 dev,
1371 fsid);
1372
1373 return 0;
1374 }
1375
1376 /*
1377 * initialise the /proc/fs/nfsfs/ directory
1378 */
1379 int __init nfs_fs_proc_init(void)
1380 {
1381 struct proc_dir_entry *p;
1382
1383 proc_fs_nfs = proc_mkdir("nfsfs", proc_root_fs);
1384 if (!proc_fs_nfs)
1385 goto error_0;
1386
1387 proc_fs_nfs->owner = THIS_MODULE;
1388
1389 /* a file of servers with which we're dealing */
1390 p = create_proc_entry("servers", S_IFREG|S_IRUGO, proc_fs_nfs);
1391 if (!p)
1392 goto error_1;
1393
1394 p->proc_fops = &nfs_server_list_fops;
1395 p->owner = THIS_MODULE;
1396
1397 /* a file of volumes that we have mounted */
1398 p = create_proc_entry("volumes", S_IFREG|S_IRUGO, proc_fs_nfs);
1399 if (!p)
1400 goto error_2;
1401
1402 p->proc_fops = &nfs_volume_list_fops;
1403 p->owner = THIS_MODULE;
1404 return 0;
1405
1406 error_2:
1407 remove_proc_entry("servers", proc_fs_nfs);
1408 error_1:
1409 remove_proc_entry("nfsfs", proc_root_fs);
1410 error_0:
1411 return -ENOMEM;
1412 }
1413
1414 /*
1415 * clean up the /proc/fs/nfsfs/ directory
1416 */
1417 void nfs_fs_proc_exit(void)
1418 {
1419 remove_proc_entry("volumes", proc_fs_nfs);
1420 remove_proc_entry("servers", proc_fs_nfs);
1421 remove_proc_entry("nfsfs", proc_root_fs);
1422 }
1423
1424 #endif /* CONFIG_PROC_FS */