aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-11-12 17:32:21 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:04 -0500
commite331f606a85a2a9e84e9c63c94d43c0517136139 (patch)
tree988f2d450ee49279f7abbce2fdd27801ca24904b /fs/nfsd
parent440bcc592052e42c7050a51489c65e18df4a0636 (diff)
nfsd: fail init on /proc/fs/nfs/exports creation failure
I assume the reason failure of creation was ignored here was just to continue support embedded systems that want nfsd but not proc. However, in cases where proc is supported it would be clearer to fail entirely than to come up with some features disabled. 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/nfsctl.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 2bfda9b8f504..2b95597aa4a5 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -674,6 +674,27 @@ static struct file_system_type nfsd_fs_type = {
674 .kill_sb = kill_litter_super, 674 .kill_sb = kill_litter_super,
675}; 675};
676 676
677#ifdef CONFIG_PROC_FS
678static int create_proc_exports_entry(void)
679{
680 struct proc_dir_entry *entry;
681
682 entry = proc_mkdir("fs/nfs", NULL);
683 if (!entry)
684 return -ENOMEM;
685 entry = create_proc_entry("fs/nfs/exports", 0, NULL);
686 if (!entry)
687 return -ENOMEM;
688 entry->proc_fops = &exports_operations;
689 return 0;
690}
691#else /* CONFIG_PROC_FS */
692static int create_proc_exports_entry(void)
693{
694 return 0;
695}
696#endif
697
677static int __init init_nfsd(void) 698static int __init init_nfsd(void)
678{ 699{
679 int retval; 700 int retval;
@@ -689,23 +710,21 @@ static int __init init_nfsd(void)
689 nfsd_export_init(); /* Exports table */ 710 nfsd_export_init(); /* Exports table */
690 nfsd_lockd_init(); /* lockd->nfsd callbacks */ 711 nfsd_lockd_init(); /* lockd->nfsd callbacks */
691 nfsd_idmap_init(); /* Name to ID mapping */ 712 nfsd_idmap_init(); /* Name to ID mapping */
692 if (proc_mkdir("fs/nfs", NULL)) { 713 retval = create_proc_exports_entry();
693 struct proc_dir_entry *entry; 714 if (retval)
694 entry = create_proc_entry("fs/nfs/exports", 0, NULL); 715 goto out_free_idmap;
695 if (entry)
696 entry->proc_fops = &exports_operations;
697 }
698 retval = register_filesystem(&nfsd_fs_type); 716 retval = register_filesystem(&nfsd_fs_type);
699 if (retval) 717 if (retval)
700 goto out_free_all; 718 goto out_free_all;
701 return 0; 719 return 0;
702out_free_all: 720out_free_all:
703 nfsd_idmap_shutdown();
704 nfsd_export_shutdown();
705 nfsd_reply_cache_shutdown();
706 remove_proc_entry("fs/nfs/exports", NULL); 721 remove_proc_entry("fs/nfs/exports", NULL);
707 remove_proc_entry("fs/nfs", NULL); 722 remove_proc_entry("fs/nfs", NULL);
723 nfsd_idmap_shutdown();
724out_free_idmap:
708 nfsd_lockd_shutdown(); 725 nfsd_lockd_shutdown();
726 nfsd_export_shutdown();
727 nfsd_reply_cache_shutdown();
709out_free_stat: 728out_free_stat:
710 nfsd_stat_shutdown(); 729 nfsd_stat_shutdown();
711 nfsd4_free_slabs(); 730 nfsd4_free_slabs();