Whamcloud - gitweb
LU-5650 mgc: check the import stat for lprocfs 96/12896/2
authorHongchao Zhang <hongchao.zhang@intel.com>
Mon, 1 Dec 2014 22:47:05 +0000 (14:47 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Dec 2014 20:21:57 +0000 (20:21 +0000)
in lprocfs_mgc_rd_ir_state, the import state should be checked
the validity before doing further work.

This patch is back-ported from the following one:
Lustre-commit: 4295402585605e1ba210ad96c12e3820fa523f7b
Lustre-change: http://review.whamcloud.com/12327

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Change-Id: I41a5f7547d24bf61ce83dd488aef699409be209b
Reviewed-on: http://review.whamcloud.com/12896
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mgc/mgc_request.c

index 777aee4..b0a5fd0 100644 (file)
@@ -465,12 +465,17 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg)
 int lprocfs_mgc_rd_ir_state(char *page, char **start, off_t off,
                             int count, int *eof, void *data)
 {
-        struct obd_device       *obd = data;
-        struct obd_import       *imp = obd->u.cli.cl_import;
-        struct obd_connect_data *ocd = &imp->imp_connect_data;
-        struct config_llog_data *cld;
-        int rc = 0;
-        ENTRY;
+       struct obd_device       *obd = data;
+       struct obd_import       *imp;
+       struct obd_connect_data *ocd;
+       struct config_llog_data *cld;
+       int                      rc = 0;
+       ENTRY;
+
+       LASSERT(obd != NULL);
+       LPROCFS_CLIMP_CHECK(obd);
+       imp = obd->u.cli.cl_import;
+       ocd = &imp->imp_connect_data;
 
         rc = snprintf(page, count, "imperative_recovery: %s\n",
                      OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED");
@@ -487,6 +492,7 @@ int lprocfs_mgc_rd_ir_state(char *page, char **start, off_t off,
        }
        spin_unlock(&config_list_lock);
 
+       LPROCFS_CLIMP_EXIT(obd);
        RETURN(rc);
 }