aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-11-08 17:20:34 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:05 -0500
commitdbf847ecb6318d3a22c6758fe39696d00f39063a (patch)
tree2b71e776ca98bc94258f3539bd7f0ea53d2733a8 /fs/nfsd
parentffe9386b6e08e7132cb7730025d0ea310e08a182 (diff)
knfsd: allow cache_register to return error on failure
Newer server features such as nfsv4 and gss depend on proc to work, so a failure to initialize the proc files they need should be treated as fatal. Thanks to Andrew Morton for style fix and compile fix in case where CONFIG_NFSD_V4 is undefined. Cc: Andrew Morton <akpm@linux-foundation.org> Acked-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/export.c12
-rw-r--r--fs/nfsd/nfs4idmap.c13
-rw-r--r--fs/nfsd/nfsctl.c12
3 files changed, 28 insertions, 9 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index d29b70a28f2b..cbbc594ef592 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1637,13 +1637,19 @@ exp_verify_string(char *cp, int max)
1637/* 1637/*
1638 * Initialize the exports module. 1638 * Initialize the exports module.
1639 */ 1639 */
1640void 1640int
1641nfsd_export_init(void) 1641nfsd_export_init(void)
1642{ 1642{
1643 int rv;
1643 dprintk("nfsd: initializing export module.\n"); 1644 dprintk("nfsd: initializing export module.\n");
1644 1645
1645 cache_register(&svc_export_cache); 1646 rv = cache_register(&svc_export_cache);
1646 cache_register(&svc_expkey_cache); 1647 if (rv)
1648 return rv;
1649 rv = cache_register(&svc_expkey_cache);
1650 if (rv)
1651 cache_unregister(&svc_export_cache);
1652 return rv;
1647 1653
1648} 1654}
1649 1655
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index ef22179c49ad..996bd88b75ba 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -464,11 +464,18 @@ nametoid_update(struct ent *new, struct ent *old)
464 * Exported API 464 * Exported API
465 */ 465 */
466 466
467void 467int
468nfsd_idmap_init(void) 468nfsd_idmap_init(void)
469{ 469{
470 cache_register(&idtoname_cache); 470 int rv;
471 cache_register(&nametoid_cache); 471
472 rv = cache_register(&idtoname_cache);
473 if (rv)
474 return rv;
475 rv = cache_register(&nametoid_cache);
476 if (rv)
477 cache_unregister(&idtoname_cache);
478 return rv;
472} 479}
473 480
474void 481void
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 2b95597aa4a5..4aba92698581 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -707,9 +707,13 @@ static int __init init_nfsd(void)
707 retval = nfsd_reply_cache_init(); 707 retval = nfsd_reply_cache_init();
708 if (retval) 708 if (retval)
709 goto out_free_stat; 709 goto out_free_stat;
710 nfsd_export_init(); /* Exports table */ 710 retval = nfsd_export_init();
711 if (retval)
712 goto out_free_cache;
711 nfsd_lockd_init(); /* lockd->nfsd callbacks */ 713 nfsd_lockd_init(); /* lockd->nfsd callbacks */
712 nfsd_idmap_init(); /* Name to ID mapping */ 714 retval = nfsd_idmap_init();
715 if (retval)
716 goto out_free_lockd;
713 retval = create_proc_exports_entry(); 717 retval = create_proc_exports_entry();
714 if (retval) 718 if (retval)
715 goto out_free_idmap; 719 goto out_free_idmap;
@@ -720,10 +724,12 @@ static int __init init_nfsd(void)
720out_free_all: 724out_free_all:
721 remove_proc_entry("fs/nfs/exports", NULL); 725 remove_proc_entry("fs/nfs/exports", NULL);
722 remove_proc_entry("fs/nfs", NULL); 726 remove_proc_entry("fs/nfs", NULL);
723 nfsd_idmap_shutdown();
724out_free_idmap: 727out_free_idmap:
728 nfsd_idmap_shutdown();
729out_free_lockd:
725 nfsd_lockd_shutdown(); 730 nfsd_lockd_shutdown();
726 nfsd_export_shutdown(); 731 nfsd_export_shutdown();
732out_free_cache:
727 nfsd_reply_cache_shutdown(); 733 nfsd_reply_cache_shutdown();
728out_free_stat: 734out_free_stat:
729 nfsd_stat_shutdown(); 735 nfsd_stat_shutdown();