Whamcloud - gitweb
LU-11175 osc: serialize access to idle_timeout vs cleanup 83/32883/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Thu, 26 Jul 2018 07:52:38 +0000 (11:52 +0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Aug 2018 02:22:56 +0000 (02:22 +0000)
use LPROCFS_CLIMP_CHECK() and LPROCFS_CLIMP_EXIT() as cl_import
can disappear due to umount.

Change-Id: I2a067f416691f39cde13cfae8f64ed5769d92041
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/32883
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osc/lproc_osc.c

index 5c012e4..ba87e17 100644 (file)
@@ -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;
 }