blob: 36e8e135d5a654e65d045e9740e18a6c08850605 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/fs/nfsd/nfsctl.c
3 *
4 * Syscall interface to knfsd.
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/module.h>
10
11#include <linux/linkage.h>
12#include <linux/time.h>
13#include <linux/errno.h>
14#include <linux/fs.h>
15#include <linux/fcntl.h>
16#include <linux/net.h>
17#include <linux/in.h>
18#include <linux/syscalls.h>
19#include <linux/unistd.h>
20#include <linux/slab.h>
21#include <linux/proc_fs.h>
22#include <linux/seq_file.h>
23#include <linux/pagemap.h>
24#include <linux/init.h>
NeilBrown70c3b762005-11-07 01:00:25 -080025#include <linux/string.h>
NeilBrown80212d52006-10-02 02:17:47 -070026#include <linux/smp_lock.h>
NeilBrownb41b66d2006-10-02 02:17:48 -070027#include <linux/ctype.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29#include <linux/nfs.h>
30#include <linux/nfsd_idmap.h>
NeilBrownb41b66d2006-10-02 02:17:48 -070031#include <linux/lockd/bind.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/sunrpc/svc.h>
NeilBrown80212d52006-10-02 02:17:47 -070033#include <linux/sunrpc/svcsock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/nfsd/nfsd.h>
35#include <linux/nfsd/cache.h>
36#include <linux/nfsd/xdr.h>
37#include <linux/nfsd/syscall.h>
38#include <linux/nfsd/interface.h>
39
40#include <asm/uaccess.h>
41
42/*
43 * We have a single directory with 9 nodes in it.
44 */
45enum {
46 NFSD_Root = 1,
47 NFSD_Svc,
48 NFSD_Add,
49 NFSD_Del,
50 NFSD_Export,
51 NFSD_Unexport,
52 NFSD_Getfd,
53 NFSD_Getfs,
54 NFSD_List,
55 NFSD_Fh,
56 NFSD_Threads,
NeilBrown70c3b762005-11-07 01:00:25 -080057 NFSD_Versions,
NeilBrown80212d52006-10-02 02:17:47 -070058 NFSD_Ports,
NeilBrown70c3b762005-11-07 01:00:25 -080059 /*
60 * The below MUST come last. Otherwise we leave a hole in nfsd_files[]
61 * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops
62 */
63#ifdef CONFIG_NFSD_V4
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 NFSD_Leasetime,
NeilBrown0964a3d2005-06-23 22:04:32 -070065 NFSD_RecoveryDir,
NeilBrown70c3b762005-11-07 01:00:25 -080066#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070067};
68
69/*
70 * write() for these nodes.
71 */
72static ssize_t write_svc(struct file *file, char *buf, size_t size);
73static ssize_t write_add(struct file *file, char *buf, size_t size);
74static ssize_t write_del(struct file *file, char *buf, size_t size);
75static ssize_t write_export(struct file *file, char *buf, size_t size);
76static ssize_t write_unexport(struct file *file, char *buf, size_t size);
77static ssize_t write_getfd(struct file *file, char *buf, size_t size);
78static ssize_t write_getfs(struct file *file, char *buf, size_t size);
79static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
80static ssize_t write_threads(struct file *file, char *buf, size_t size);
NeilBrown70c3b762005-11-07 01:00:25 -080081static ssize_t write_versions(struct file *file, char *buf, size_t size);
NeilBrown80212d52006-10-02 02:17:47 -070082static ssize_t write_ports(struct file *file, char *buf, size_t size);
NeilBrown70c3b762005-11-07 01:00:25 -080083#ifdef CONFIG_NFSD_V4
Linus Torvalds1da177e2005-04-16 15:20:36 -070084static ssize_t write_leasetime(struct file *file, char *buf, size_t size);
NeilBrown0964a3d2005-06-23 22:04:32 -070085static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
NeilBrown70c3b762005-11-07 01:00:25 -080086#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88static ssize_t (*write_op[])(struct file *, char *, size_t) = {
89 [NFSD_Svc] = write_svc,
90 [NFSD_Add] = write_add,
91 [NFSD_Del] = write_del,
92 [NFSD_Export] = write_export,
93 [NFSD_Unexport] = write_unexport,
94 [NFSD_Getfd] = write_getfd,
95 [NFSD_Getfs] = write_getfs,
96 [NFSD_Fh] = write_filehandle,
97 [NFSD_Threads] = write_threads,
NeilBrown70c3b762005-11-07 01:00:25 -080098 [NFSD_Versions] = write_versions,
NeilBrown80212d52006-10-02 02:17:47 -070099 [NFSD_Ports] = write_ports,
NeilBrown70c3b762005-11-07 01:00:25 -0800100#ifdef CONFIG_NFSD_V4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 [NFSD_Leasetime] = write_leasetime,
NeilBrown0964a3d2005-06-23 22:04:32 -0700102 [NFSD_RecoveryDir] = write_recoverydir,
NeilBrown70c3b762005-11-07 01:00:25 -0800103#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104};
105
106static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
107{
108 ino_t ino = file->f_dentry->d_inode->i_ino;
109 char *data;
110 ssize_t rv;
111
Tobias Klausere8c96f82006-03-24 03:15:34 -0800112 if (ino >= ARRAY_SIZE(write_op) || !write_op[ino])
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 return -EINVAL;
114
115 data = simple_transaction_get(file, buf, size);
116 if (IS_ERR(data))
117 return PTR_ERR(data);
118
119 rv = write_op[ino](file, data, size);
120 if (rv>0) {
121 simple_transaction_set(file, rv);
122 rv = size;
123 }
124 return rv;
125}
126
NeilBrown73900222005-11-07 01:00:24 -0800127static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
128{
129 if (! file->private_data) {
130 /* An attempt to read a transaction file without writing
131 * causes a 0-byte write so that the file can return
132 * state information
133 */
134 ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos);
135 if (rv < 0)
136 return rv;
137 }
138 return simple_transaction_read(file, buf, size, pos);
139}
140
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800141static const struct file_operations transaction_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 .write = nfsctl_transaction_write,
NeilBrown73900222005-11-07 01:00:24 -0800143 .read = nfsctl_transaction_read,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 .release = simple_transaction_release,
145};
146
147extern struct seq_operations nfs_exports_op;
148static int exports_open(struct inode *inode, struct file *file)
149{
150 return seq_open(file, &nfs_exports_op);
151}
152
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800153static const struct file_operations exports_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 .open = exports_open,
155 .read = seq_read,
156 .llseek = seq_lseek,
157 .release = seq_release,
158};
159
160/*----------------------------------------------------------------------------*/
161/*
162 * payload - write methods
163 * If the method has a response, the response should be put in buf,
164 * and the length returned. Otherwise return 0 or and -error.
165 */
166
167static ssize_t write_svc(struct file *file, char *buf, size_t size)
168{
169 struct nfsctl_svc *data;
170 if (size < sizeof(*data))
171 return -EINVAL;
172 data = (struct nfsctl_svc*) buf;
173 return nfsd_svc(data->svc_port, data->svc_nthreads);
174}
175
176static ssize_t write_add(struct file *file, char *buf, size_t size)
177{
178 struct nfsctl_client *data;
179 if (size < sizeof(*data))
180 return -EINVAL;
181 data = (struct nfsctl_client *)buf;
182 return exp_addclient(data);
183}
184
185static ssize_t write_del(struct file *file, char *buf, size_t size)
186{
187 struct nfsctl_client *data;
188 if (size < sizeof(*data))
189 return -EINVAL;
190 data = (struct nfsctl_client *)buf;
191 return exp_delclient(data);
192}
193
194static ssize_t write_export(struct file *file, char *buf, size_t size)
195{
196 struct nfsctl_export *data;
197 if (size < sizeof(*data))
198 return -EINVAL;
199 data = (struct nfsctl_export*)buf;
200 return exp_export(data);
201}
202
203static ssize_t write_unexport(struct file *file, char *buf, size_t size)
204{
205 struct nfsctl_export *data;
206
207 if (size < sizeof(*data))
208 return -EINVAL;
209 data = (struct nfsctl_export*)buf;
210 return exp_unexport(data);
211}
212
213static ssize_t write_getfs(struct file *file, char *buf, size_t size)
214{
215 struct nfsctl_fsparm *data;
216 struct sockaddr_in *sin;
217 struct auth_domain *clp;
218 int err = 0;
219 struct knfsd_fh *res;
220
221 if (size < sizeof(*data))
222 return -EINVAL;
223 data = (struct nfsctl_fsparm*)buf;
224 err = -EPROTONOSUPPORT;
225 if (data->gd_addr.sa_family != AF_INET)
226 goto out;
227 sin = (struct sockaddr_in *)&data->gd_addr;
228 if (data->gd_maxlen > NFS3_FHSIZE)
229 data->gd_maxlen = NFS3_FHSIZE;
230
231 res = (struct knfsd_fh*)buf;
232
233 exp_readlock();
234 if (!(clp = auth_unix_lookup(sin->sin_addr)))
235 err = -EPERM;
236 else {
237 err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
238 auth_domain_put(clp);
239 }
240 exp_readunlock();
241 if (err == 0)
242 err = res->fh_size + (int)&((struct knfsd_fh*)0)->fh_base;
243 out:
244 return err;
245}
246
247static ssize_t write_getfd(struct file *file, char *buf, size_t size)
248{
249 struct nfsctl_fdparm *data;
250 struct sockaddr_in *sin;
251 struct auth_domain *clp;
252 int err = 0;
253 struct knfsd_fh fh;
254 char *res;
255
256 if (size < sizeof(*data))
257 return -EINVAL;
258 data = (struct nfsctl_fdparm*)buf;
259 err = -EPROTONOSUPPORT;
260 if (data->gd_addr.sa_family != AF_INET)
261 goto out;
262 err = -EINVAL;
263 if (data->gd_version < 2 || data->gd_version > NFSSVC_MAXVERS)
264 goto out;
265
266 res = buf;
267 sin = (struct sockaddr_in *)&data->gd_addr;
268 exp_readlock();
269 if (!(clp = auth_unix_lookup(sin->sin_addr)))
270 err = -EPERM;
271 else {
272 err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
273 auth_domain_put(clp);
274 }
275 exp_readunlock();
276
277 if (err == 0) {
278 memset(res,0, NFS_FHSIZE);
279 memcpy(res, &fh.fh_base, fh.fh_size);
280 err = NFS_FHSIZE;
281 }
282 out:
283 return err;
284}
285
286static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
287{
288 /* request is:
289 * domain path maxsize
290 * response is
291 * filehandle
292 *
293 * qword quoting is used, so filehandle will be \x....
294 */
295 char *dname, *path;
296 int maxsize;
297 char *mesg = buf;
298 int len;
299 struct auth_domain *dom;
300 struct knfsd_fh fh;
301
302 if (buf[size-1] != '\n')
303 return -EINVAL;
304 buf[size-1] = 0;
305
306 dname = mesg;
307 len = qword_get(&mesg, dname, size);
308 if (len <= 0) return -EINVAL;
309
310 path = dname+len+1;
311 len = qword_get(&mesg, path, size);
312 if (len <= 0) return -EINVAL;
313
314 len = get_int(&mesg, &maxsize);
315 if (len)
316 return len;
317
318 if (maxsize < NFS_FHSIZE)
319 return -EINVAL;
320 if (maxsize > NFS3_FHSIZE)
321 maxsize = NFS3_FHSIZE;
322
323 if (qword_get(&mesg, mesg, size)>0)
324 return -EINVAL;
325
326 /* we have all the words, they are in buf.. */
327 dom = unix_domain_find(dname);
328 if (!dom)
329 return -ENOMEM;
330
331 len = exp_rootfh(dom, path, &fh, maxsize);
332 auth_domain_put(dom);
333 if (len)
334 return len;
335
336 mesg = buf; len = SIMPLE_TRANSACTION_LIMIT;
337 qword_addhex(&mesg, &len, (char*)&fh.fh_base, fh.fh_size);
338 mesg[-1] = '\n';
339 return mesg - buf;
340}
341
342extern int nfsd_nrthreads(void);
343
344static ssize_t write_threads(struct file *file, char *buf, size_t size)
345{
346 /* if size > 0, look for a number of threads and call nfsd_svc
347 * then write out number of threads as reply
348 */
349 char *mesg = buf;
350 int rv;
351 if (size > 0) {
352 int newthreads;
353 rv = get_int(&mesg, &newthreads);
354 if (rv)
355 return rv;
356 if (newthreads <0)
357 return -EINVAL;
358 rv = nfsd_svc(2049, newthreads);
359 if (rv)
360 return rv;
361 }
362 sprintf(buf, "%d\n", nfsd_nrthreads());
363 return strlen(buf);
364}
365
NeilBrown70c3b762005-11-07 01:00:25 -0800366static ssize_t write_versions(struct file *file, char *buf, size_t size)
367{
368 /*
369 * Format:
370 * [-/+]vers [-/+]vers ...
371 */
372 char *mesg = buf;
373 char *vers, sign;
374 int len, num;
375 ssize_t tlen = 0;
376 char *sep;
377
378 if (size>0) {
379 if (nfsd_serv)
NeilBrown6658d3a2006-10-02 02:17:46 -0700380 /* Cannot change versions without updating
381 * nfsd_serv->sv_xdrsize, and reallocing
382 * rq_argp and rq_resp
383 */
NeilBrown70c3b762005-11-07 01:00:25 -0800384 return -EBUSY;
385 if (buf[size-1] != '\n')
386 return -EINVAL;
387 buf[size-1] = 0;
388
389 vers = mesg;
390 len = qword_get(&mesg, vers, size);
391 if (len <= 0) return -EINVAL;
392 do {
393 sign = *vers;
394 if (sign == '+' || sign == '-')
395 num = simple_strtol((vers+1), NULL, 0);
396 else
397 num = simple_strtol(vers, NULL, 0);
398 switch(num) {
399 case 2:
400 case 3:
401 case 4:
NeilBrown6658d3a2006-10-02 02:17:46 -0700402 nfsd_vers(num, sign == '-' ? NFSD_CLEAR : NFSD_SET);
NeilBrown70c3b762005-11-07 01:00:25 -0800403 break;
404 default:
405 return -EINVAL;
406 }
407 vers += len + 1;
408 tlen += len;
409 } while ((len = qword_get(&mesg, vers, size)) > 0);
410 /* If all get turned off, turn them back on, as
411 * having no versions is BAD
412 */
NeilBrown6658d3a2006-10-02 02:17:46 -0700413 nfsd_reset_versions();
NeilBrown70c3b762005-11-07 01:00:25 -0800414 }
415 /* Now write current state into reply buffer */
416 len = 0;
417 sep = "";
418 for (num=2 ; num <= 4 ; num++)
NeilBrown6658d3a2006-10-02 02:17:46 -0700419 if (nfsd_vers(num, NFSD_AVAIL)) {
NeilBrown70c3b762005-11-07 01:00:25 -0800420 len += sprintf(buf+len, "%s%c%d", sep,
NeilBrown6658d3a2006-10-02 02:17:46 -0700421 nfsd_vers(num, NFSD_TEST)?'+':'-',
NeilBrown70c3b762005-11-07 01:00:25 -0800422 num);
423 sep = " ";
424 }
425 len += sprintf(buf+len, "\n");
426 return len;
427}
428
NeilBrown80212d52006-10-02 02:17:47 -0700429static ssize_t write_ports(struct file *file, char *buf, size_t size)
430{
NeilBrownb41b66d2006-10-02 02:17:48 -0700431 if (size == 0) {
432 int len = 0;
433 lock_kernel();
434 if (nfsd_serv)
435 len = svc_sock_names(buf, nfsd_serv, NULL);
436 unlock_kernel();
437 return len;
438 }
439 /* Either a single 'fd' number is written, in which
440 * case it must be for a socket of a supported family/protocol,
441 * and we use it as an nfsd socket, or
442 * A '-' followed by the 'name' of a socket in which case
443 * we close the socket.
NeilBrown80212d52006-10-02 02:17:47 -0700444 */
NeilBrownb41b66d2006-10-02 02:17:48 -0700445 if (isdigit(buf[0])) {
446 char *mesg = buf;
447 int fd;
448 int err;
449 err = get_int(&mesg, &fd);
450 if (err)
451 return -EINVAL;
452 if (fd < 0)
453 return -EINVAL;
454 err = nfsd_create_serv();
455 if (!err) {
456 int proto = 0;
NeilBrown3dfb4212006-10-02 02:17:51 -0700457 err = lockd_up(proto);
458 if (!err) {
459 err = svc_addsock(nfsd_serv, fd, buf, &proto);
460 if (err)
461 lockd_down();
462 }
NeilBrownb41b66d2006-10-02 02:17:48 -0700463 /* Decrease the count, but don't shutdown the
464 * the service
465 */
NeilBrownb41b66d2006-10-02 02:17:48 -0700466 nfsd_serv->sv_nrthreads--;
467 }
468 return err;
469 }
470 if (buf[0] == '-') {
471 char *toclose = kstrdup(buf+1, GFP_KERNEL);
472 int len = 0;
473 if (!toclose)
474 return -ENOMEM;
475 lock_kernel();
476 if (nfsd_serv)
477 len = svc_sock_names(buf, nfsd_serv, toclose);
478 unlock_kernel();
479 kfree(toclose);
480 return len;
481 }
482 return -EINVAL;
NeilBrown80212d52006-10-02 02:17:47 -0700483}
484
NeilBrown70c3b762005-11-07 01:00:25 -0800485#ifdef CONFIG_NFSD_V4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486extern time_t nfs4_leasetime(void);
487
488static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
489{
490 /* if size > 10 seconds, call
491 * nfs4_reset_lease() then write out the new lease (seconds) as reply
492 */
493 char *mesg = buf;
494 int rv;
495
496 if (size > 0) {
497 int lease;
498 rv = get_int(&mesg, &lease);
499 if (rv)
500 return rv;
501 if (lease < 10 || lease > 3600)
502 return -EINVAL;
503 nfs4_reset_lease(lease);
504 }
505 sprintf(buf, "%ld\n", nfs4_lease_time());
506 return strlen(buf);
507}
508
NeilBrown0964a3d2005-06-23 22:04:32 -0700509static ssize_t write_recoverydir(struct file *file, char *buf, size_t size)
510{
511 char *mesg = buf;
512 char *recdir;
513 int len, status;
514
515 if (size > PATH_MAX || buf[size-1] != '\n')
516 return -EINVAL;
517 buf[size-1] = 0;
518
519 recdir = mesg;
520 len = qword_get(&mesg, recdir, size);
521 if (len <= 0)
522 return -EINVAL;
523
524 status = nfs4_reset_recoverydir(recdir);
525 return strlen(buf);
526}
NeilBrown70c3b762005-11-07 01:00:25 -0800527#endif
NeilBrown0964a3d2005-06-23 22:04:32 -0700528
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529/*----------------------------------------------------------------------------*/
530/*
531 * populating the filesystem.
532 */
533
534static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
535{
536 static struct tree_descr nfsd_files[] = {
537 [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR},
538 [NFSD_Add] = {".add", &transaction_ops, S_IWUSR},
539 [NFSD_Del] = {".del", &transaction_ops, S_IWUSR},
540 [NFSD_Export] = {".export", &transaction_ops, S_IWUSR},
541 [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR},
542 [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
543 [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
544 [NFSD_List] = {"exports", &exports_operations, S_IRUGO},
545 [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
546 [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
NeilBrown70c3b762005-11-07 01:00:25 -0800547 [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
NeilBrown80212d52006-10-02 02:17:47 -0700548 [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549#ifdef CONFIG_NFSD_V4
550 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
NeilBrown0964a3d2005-06-23 22:04:32 -0700551 [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552#endif
553 /* last one */ {""}
554 };
555 return simple_fill_super(sb, 0x6e667364, nfsd_files);
556}
557
David Howells454e2392006-06-23 02:02:57 -0700558static int nfsd_get_sb(struct file_system_type *fs_type,
559 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560{
David Howells454e2392006-06-23 02:02:57 -0700561 return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562}
563
564static struct file_system_type nfsd_fs_type = {
565 .owner = THIS_MODULE,
566 .name = "nfsd",
567 .get_sb = nfsd_get_sb,
568 .kill_sb = kill_litter_super,
569};
570
571static int __init init_nfsd(void)
572{
573 int retval;
574 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
575
576 nfsd_stat_init(); /* Statistics */
577 nfsd_cache_init(); /* RPC reply cache */
578 nfsd_export_init(); /* Exports table */
579 nfsd_lockd_init(); /* lockd->nfsd callbacks */
NeilBrownac4d8ff2005-06-23 22:03:30 -0700580 nfs4_state_init(); /* NFSv4 locking state */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 nfsd_idmap_init(); /* Name to ID mapping */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 if (proc_mkdir("fs/nfs", NULL)) {
583 struct proc_dir_entry *entry;
584 entry = create_proc_entry("fs/nfs/exports", 0, NULL);
585 if (entry)
586 entry->proc_fops = &exports_operations;
587 }
588 retval = register_filesystem(&nfsd_fs_type);
589 if (retval) {
590 nfsd_export_shutdown();
591 nfsd_cache_shutdown();
592 remove_proc_entry("fs/nfs/exports", NULL);
593 remove_proc_entry("fs/nfs", NULL);
594 nfsd_stat_shutdown();
595 nfsd_lockd_shutdown();
596 }
597 return retval;
598}
599
600static void __exit exit_nfsd(void)
601{
602 nfsd_export_shutdown();
603 nfsd_cache_shutdown();
604 remove_proc_entry("fs/nfs/exports", NULL);
605 remove_proc_entry("fs/nfs", NULL);
606 nfsd_stat_shutdown();
607 nfsd_lockd_shutdown();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 nfsd_idmap_shutdown();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 unregister_filesystem(&nfsd_fs_type);
610}
611
612MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
613MODULE_LICENSE("GPL");
614module_init(init_nfsd)
615module_exit(exit_nfsd)