Whamcloud - gitweb
LU-5650 mgc: check the import stat for lprocfs 27/12327/2
authorHongchao Zhang <hongchao.zhang@intel.com>
Tue, 9 Sep 2014 12:18:17 +0000 (20:18 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 27 Nov 2014 02:33:58 +0000 (02:33 +0000)
in lprocfs_mgc_rd_ir_state, the import state should be checked
the validity before doing further work.

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

index 66b3329..1788874 100644 (file)
@@ -466,11 +466,16 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg)
 #ifdef LPROCFS
 int lprocfs_mgc_rd_ir_state(struct seq_file *m, 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;
-        ENTRY;
+       struct obd_device       *obd = data;
+       struct obd_import       *imp;
+       struct obd_connect_data *ocd;
+       struct config_llog_data *cld;
+       ENTRY;
+
+       LASSERT(obd != NULL);
+       LPROCFS_CLIMP_CHECK(obd);
+       imp = obd->u.cli.cl_import;
+       ocd = &imp->imp_connect_data;
 
        seq_printf(m, "imperative_recovery: %s\n",
                   OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED");
@@ -486,6 +491,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)
        }
        spin_unlock(&config_list_lock);
 
+       LPROCFS_CLIMP_EXIT(obd);
        RETURN(0);
 }
 #endif