Whamcloud - gitweb
LU-12759 osc: don't re-enable grant shrink on reconnect 77/36177/5
authorAlexander Zarochentsev <c17826@cray.com>
Wed, 10 Jul 2019 18:37:33 +0000 (21:37 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 12 Nov 2019 04:06:33 +0000 (04:06 +0000)
client requests grant shrinking support on each
reconnect and re-enables the capability even it was
explicitly disabled by lctl set_param.

Cray-bug-id: LUS-7585
Signed-off-by: Alexander Zarochentsev <c17826@cray.com>
Change-Id: I87b1718022ee3346c9b177890a118410c5757458
Reviewed-on: https://review.whamcloud.com/36177
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andrew Perepechko <c17827@cray.com>
Reviewed-by: Andriy Skulysh <c17819@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_import.h
lustre/osc/lproc_osc.c
lustre/osc/osc_request.c

index 682f4dc..a2de838 100644 (file)
@@ -307,7 +307,9 @@ struct obd_import {
                                  /* import has tried to connect with server */
                                  imp_connect_tried:1,
                                  /* connected but not FULL yet */
-                                 imp_connected:1;
+                                 imp_connected:1,
+                                 /* grant shrink disabled */
+                                 imp_grant_shrink_disabled:1;
        u32                       imp_connect_op;
        u32                       imp_idle_timeout;
        u32                       imp_idle_debug;
index 414d918..2d15ebb 100644 (file)
@@ -697,15 +697,14 @@ static ssize_t grant_shrink_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;
-       struct obd_connect_data *ocd;
+       struct obd_import *imp;
        ssize_t len;
 
        LPROCFS_CLIMP_CHECK(obd);
-       ocd = &cli->cl_import->imp_connect_data;
-
+       imp = obd->u.cli.cl_import;
        len = snprintf(buf, PAGE_SIZE, "%d\n",
-                      !!OCD_HAS_FLAG(ocd, GRANT_SHRINK));
+                      !imp->imp_grant_shrink_disabled &&
+                      OCD_HAS_FLAG(&imp->imp_connect_data, GRANT_SHRINK));
        LPROCFS_CLIMP_EXIT(obd);
 
        return len;
@@ -716,8 +715,7 @@ static ssize_t grant_shrink_store(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *dev = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct client_obd *cli = &dev->u.cli;
-       struct obd_connect_data *ocd;
+       struct obd_import *imp;
        bool val;
        int rc;
 
@@ -729,22 +727,11 @@ static ssize_t grant_shrink_store(struct kobject *kobj, struct attribute *attr,
                return rc;
 
        LPROCFS_CLIMP_CHECK(dev);
-       ocd = &cli->cl_import->imp_connect_data;
 
-       if (!val) {
-               if (OCD_HAS_FLAG(ocd, GRANT_SHRINK))
-                       ocd->ocd_connect_flags &= ~OBD_CONNECT_GRANT_SHRINK;
-       } else {
-               /**
-                * server replied obd_connect_data is always bigger, so
-                * client's imp_connect_flags_orig are always supported
-                * by the server
-                */
-               if (!OCD_HAS_FLAG(ocd, GRANT_SHRINK) &&
-                   cli->cl_import->imp_connect_flags_orig &
-                   OBD_CONNECT_GRANT_SHRINK)
-                       ocd->ocd_connect_flags |= OBD_CONNECT_GRANT_SHRINK;
-       }
+       imp = dev->u.cli.cl_import;
+       spin_lock(&imp->imp_lock);
+       imp->imp_grant_shrink_disabled = !val;
+       spin_unlock(&imp->imp_lock);
 
        LPROCFS_CLIMP_EXIT(dev);
 
index 557d2c4..42c628e 100644 (file)
@@ -845,9 +845,9 @@ static int osc_should_shrink_grant(struct client_obd *client)
        if (client->cl_import == NULL)
                return 0;
 
-        if ((client->cl_import->imp_connect_data.ocd_connect_flags &
-             OBD_CONNECT_GRANT_SHRINK) == 0)
-                return 0;
+       if (!OCD_HAS_FLAG(&client->cl_import->imp_connect_data, GRANT_SHRINK) ||
+           client->cl_import->imp_grant_shrink_disabled)
+               return 0;
 
        if (ktime_get_seconds() >= next_shrink - 5) {
                /* Get the current RPC size directly, instead of going via: