From efa3425c5f5a6763ea834408b982e4df5a90c914 Mon Sep 17 00:00:00 2001 From: Alexander Zarochentsev Date: Wed, 10 Jul 2019 21:37:33 +0300 Subject: [PATCH] LU-12759 osc: don't re-enable grant shrink on reconnect 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 Change-Id: I87b1718022ee3346c9b177890a118410c5757458 Reviewed-on: https://review.whamcloud.com/36177 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andrew Perepechko Reviewed-by: Andriy Skulysh Reviewed-by: Oleg Drokin --- lustre/include/lustre_import.h | 4 +++- lustre/osc/lproc_osc.c | 31 +++++++++---------------------- lustre/osc/osc_request.c | 6 +++--- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index 682f4dc..a2de838 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -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; diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 414d918..2d15ebb 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -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); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 557d2c4..42c628e 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -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: -- 1.8.3.1