From: Hongchao Zhang Date: Mon, 1 Dec 2014 22:47:05 +0000 (-0800) Subject: LU-5650 mgc: check the import stat for lprocfs X-Git-Tag: 2.5.3.90~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=44498ca3ab72f8644ffd016baaa0a0e5a3902fe8;p=fs%2Flustre-release.git 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. This patch is back-ported from the following one: Lustre-commit: 4295402585605e1ba210ad96c12e3820fa523f7b Lustre-change: http://review.whamcloud.com/12327 Signed-off-by: Hongchao Zhang Change-Id: I41a5f7547d24bf61ce83dd488aef699409be209b Reviewed-on: http://review.whamcloud.com/12896 Tested-by: Jenkins Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 777aee4..b0a5fd0 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -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); }