Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e331f606a85a2a9e84e9c63c94d43c0517136139
Commit:     e331f606a85a2a9e84e9c63c94d43c0517136139
Parent:     440bcc592052e42c7050a51489c65e18df4a0636
Author:     J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 12 17:32:21 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Fri Feb 1 16:42:04 2008 -0500

    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 <[EMAIL PROTECTED]>
    Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/nfsd/nfsctl.c |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 2bfda9b..2b95597 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -674,6 +674,27 @@ static struct file_system_type nfsd_fs_type = {
        .kill_sb        = kill_litter_super,
 };
 
+#ifdef CONFIG_PROC_FS
+static int create_proc_exports_entry(void)
+{
+       struct proc_dir_entry *entry;
+
+       entry = proc_mkdir("fs/nfs", NULL);
+       if (!entry)
+               return -ENOMEM;
+       entry = create_proc_entry("fs/nfs/exports", 0, NULL);
+       if (!entry)
+               return -ENOMEM;
+       entry->proc_fops =  &exports_operations;
+       return 0;
+}
+#else /* CONFIG_PROC_FS */
+static int create_proc_exports_entry(void)
+{
+       return 0;
+}
+#endif
+
 static int __init init_nfsd(void)
 {
        int retval;
@@ -689,23 +710,21 @@ static int __init init_nfsd(void)
        nfsd_export_init();     /* Exports table */
        nfsd_lockd_init();      /* lockd->nfsd callbacks */
        nfsd_idmap_init();      /* Name to ID mapping */
-       if (proc_mkdir("fs/nfs", NULL)) {
-               struct proc_dir_entry *entry;
-               entry = create_proc_entry("fs/nfs/exports", 0, NULL);
-               if (entry)
-                       entry->proc_fops =  &exports_operations;
-       }
+       retval = create_proc_exports_entry();
+       if (retval)
+               goto out_free_idmap;
        retval = register_filesystem(&nfsd_fs_type);
        if (retval)
                goto out_free_all;
        return 0;
 out_free_all:
-       nfsd_idmap_shutdown();
-       nfsd_export_shutdown();
-       nfsd_reply_cache_shutdown();
        remove_proc_entry("fs/nfs/exports", NULL);
        remove_proc_entry("fs/nfs", NULL);
+       nfsd_idmap_shutdown();
+out_free_idmap:
        nfsd_lockd_shutdown();
+       nfsd_export_shutdown();
+       nfsd_reply_cache_shutdown();
 out_free_stat:
        nfsd_stat_shutdown();
        nfsd4_free_slabs();
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to