Whamcloud - gitweb
LU-2673 procfs: call lprocfs_free_xxx_stats() later
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 24 Jan 2013 21:41:56 +0000 (15:41 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 10 Feb 2013 03:40:21 +0000 (22:40 -0500)
Defer calls to lprocfs_free_{obd,md}_stats() and
lprocfs_job_stats_fini() until after the corresponding proc entries
have been removed. Change the return of some proc fini()s to void.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ic410a4cf12eeb084270f5e679222c54b12d80266
Reviewed-on: http://review.whamcloud.com/5160
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lproc.c
lustre/mgs/lproc_mgs.c
lustre/mgs/mgs_internal.h
lustre/ofd/ofd_dev.c

index f2ccb95..3473c94 100644 (file)
@@ -1012,7 +1012,7 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats);
 void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars);
 void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars);
 int mdt_procfs_init(struct mdt_device *mdt, const char *name);
-int mdt_procfs_fini(struct mdt_device *mdt);
+void mdt_procfs_fini(struct mdt_device *mdt);
 void mdt_rename_counter_tally(struct mdt_thread_info *info,
                              struct mdt_device *mdt,
                              struct ptlrpc_request *req,
index e627580..d922f6e 100644 (file)
@@ -258,13 +258,11 @@ int mdt_procfs_init(struct mdt_device *mdt, const char *name)
         RETURN(rc);
 }
 
-int mdt_procfs_fini(struct mdt_device *mdt)
+void mdt_procfs_fini(struct mdt_device *mdt)
 {
         struct lu_device *ld = &mdt->mdt_md_dev.md_lu_dev;
         struct obd_device *obd = ld->ld_obd;
 
-       lprocfs_job_stats_fini(obd);
-
         if (obd->obd_proc_exports_entry) {
                 lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
                 obd->obd_proc_exports_entry = NULL;
@@ -274,8 +272,7 @@ int mdt_procfs_fini(struct mdt_device *mdt)
         ptlrpc_lprocfs_unregister_obd(obd);
         lprocfs_free_md_stats(obd);
         lprocfs_free_obd_stats(obd);
-
-        RETURN(0);
+       lprocfs_job_stats_fini(obd);
 }
 
 static int lprocfs_rd_identity_expire(char *page, char **start, off_t off,
index 7020470..54f299b 100644 (file)
@@ -198,12 +198,12 @@ int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name)
        return rc;
 }
 
-int lproc_mgs_cleanup(struct mgs_device *mgs)
+void lproc_mgs_cleanup(struct mgs_device *mgs)
 {
        struct obd_device *obd = mgs->mgs_obd;
 
-        if (!obd)
-                return -EINVAL;
+       if (obd == NULL)
+               return;
 
        if (mgs->mgs_proc_osd != NULL)
                lprocfs_remove(&mgs->mgs_proc_osd);
@@ -220,10 +220,9 @@ int lproc_mgs_cleanup(struct mgs_device *mgs)
                 mgs->mgs_proc_live = NULL;
         }
         lprocfs_free_per_client_stats(obd);
+       lprocfs_obd_cleanup(obd);
         lprocfs_free_obd_stats(obd);
         lprocfs_free_md_stats(obd);
-
-        return lprocfs_obd_cleanup(obd);
 }
 
 static int mgs_live_seq_show(struct seq_file *seq, void *v)
index f62413f..00aae38 100644 (file)
@@ -242,7 +242,7 @@ int mgs_fs_cleanup(const struct lu_env *env, struct mgs_device *m);
 #define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
 #ifdef LPROCFS
 int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name);
-int lproc_mgs_cleanup(struct mgs_device *mgs);
+void lproc_mgs_cleanup(struct mgs_device *mgs);
 int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
 int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
 void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
index 13245d0..f90d820 100644 (file)
@@ -430,7 +430,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
        rc = lproc_ofd_attach_seqstat(obd);
        if (rc) {
                CERROR("%s: create seqstat failed: %d.\n", obd->obd_name, rc);
-               GOTO(free_obd_stats, rc);
+               GOTO(obd_cleanup, rc);
        }
 
        entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
@@ -438,7 +438,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
                rc = PTR_ERR(entry);
                CERROR("%s: error %d setting up lprocfs for %s\n",
                       obd->obd_name, rc, "exports");
-               GOTO(free_obd_stats, rc);
+               GOTO(obd_cleanup, rc);
        }
        obd->obd_proc_exports_entry = entry;
 
@@ -449,7 +449,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
                rc = PTR_ERR(entry);
                CERROR("%s: add proc entry 'clear' failed: %d.\n",
                       obd->obd_name, rc);
-               GOTO(free_obd_stats, rc);
+               GOTO(obd_cleanup, rc);
        }
 
        rc = lprocfs_job_stats_init(obd, LPROC_OFD_STATS_LAST,
@@ -459,23 +459,22 @@ static int ofd_procfs_init(struct ofd_device *ofd)
        RETURN(0);
 remove_entry_clear:
        lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
-free_obd_stats:
-       lprocfs_free_obd_stats(obd);
 obd_cleanup:
        lprocfs_obd_cleanup(obd);
+       lprocfs_free_obd_stats(obd);
+
        return rc;
 }
 
-static int ofd_procfs_fini(struct ofd_device *ofd)
+static void ofd_procfs_fini(struct ofd_device *ofd)
 {
        struct obd_device *obd = ofd_obd(ofd);
 
-       lprocfs_job_stats_fini(obd);
        lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
        lprocfs_free_per_client_stats(obd);
-       lprocfs_free_obd_stats(obd);
        lprocfs_obd_cleanup(obd);
-       return 0;
+       lprocfs_free_obd_stats(obd);
+       lprocfs_job_stats_fini(obd);
 }
 
 extern int ost_handle(struct ptlrpc_request *req);