From: Alex Zhuravlev Date: Thu, 26 Jul 2018 07:52:38 +0000 (+0400) Subject: LU-11175 osc: serialize access to idle_timeout vs cleanup X-Git-Tag: 2.11.55~71 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5874da0b670b7d48c9ddae38f2f9275db50dcbc5 LU-11175 osc: serialize access to idle_timeout vs cleanup use LPROCFS_CLIMP_CHECK() and LPROCFS_CLIMP_EXIT() as cl_import can disappear due to umount. Change-Id: I2a067f416691f39cde13cfae8f64ed5769d92041 Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/32883 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 5c012e4..ba87e17 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -614,8 +614,13 @@ static ssize_t idle_timeout_show(struct kobject *kobj, struct attribute *attr, struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); struct client_obd *cli = &obd->u.cli; + int ret; - return sprintf(buf, "%u\n", cli->cl_import->imp_idle_timeout); + LPROCFS_CLIMP_CHECK(obd); + ret = sprintf(buf, "%u\n", cli->cl_import->imp_idle_timeout); + LPROCFS_CLIMP_EXIT(obd); + + return ret; } static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, @@ -635,6 +640,7 @@ static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, if (val > CONNECTION_SWITCH_MAX) return -ERANGE; + LPROCFS_CLIMP_CHECK(dev); cli->cl_import->imp_idle_timeout = val; /* to initiate the connection if it's in IDLE state */ @@ -643,6 +649,7 @@ static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, if (req != NULL) ptlrpc_req_finished(req); } + LPROCFS_CLIMP_EXIT(dev); return count; } @@ -656,11 +663,13 @@ static ssize_t idle_connect_store(struct kobject *kobj, struct attribute *attr, struct client_obd *cli = &dev->u.cli; struct ptlrpc_request *req; + LPROCFS_CLIMP_CHECK(dev); /* to initiate the connection if it's in IDLE state */ req = ptlrpc_request_alloc(cli->cl_import, &RQF_OST_STATFS); if (req) ptlrpc_req_finished(req); ptlrpc_pinger_force(cli->cl_import); + LPROCFS_CLIMP_EXIT(dev); return count; }