From 4295402585605e1ba210ad96c12e3820fa523f7b Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Tue, 9 Sep 2014 20:18:17 +0800 Subject: [PATCH] LU-5650 mgc: check the import stat for lprocfs 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 Reviewed-on: http://review.whamcloud.com/12327 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/mgc/mgc_request.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 66b3329..1788874 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -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 -- 1.8.3.1