From patchwork Thu Feb 27 21:16:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410915 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21A8C17E0 for ; Thu, 27 Feb 2020 21:51:00 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A6FD24692 for ; Thu, 27 Feb 2020 21:51:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A6FD24692 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id B41B6348D3B; Thu, 27 Feb 2020 13:43:48 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 9B4493488BF for ; Thu, 27 Feb 2020 13:21:00 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 62E4291A3; Thu, 27 Feb 2020 16:18:19 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 614CA468; Thu, 27 Feb 2020 16:18:19 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:16:29 -0500 Message-Id: <1582838290-17243-522-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 521/622] lustre: osc: don't re-enable grant shrink on reconnect X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Zarochentsev , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Alexander Zarochentsev 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 WC-bug-id: https://jira.whamcloud.com/browse/LU-12759 Lustre-commit: efa3425c5f5a ("LU-12759 osc: don't re-enable grant shrink on reconnect") Signed-off-by: Alexander Zarochentsev Reviewed-on: https://review.whamcloud.com/36177 Reviewed-by: Andrew Perepechko Reviewed-by: Andriy Skulysh Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/lustre_import.h | 4 +++- fs/lustre/osc/lproc_osc.c | 32 +++++++++----------------------- fs/lustre/osc/osc_request.c | 4 ++-- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/fs/lustre/include/lustre_import.h b/fs/lustre/include/lustre_import.h index c2f98e6..501a896 100644 --- a/fs/lustre/include/lustre_import.h +++ b/fs/lustre/include/lustre_import.h @@ -303,7 +303,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; diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c index 8e0088b..2bc7047 100644 --- a/fs/lustre/osc/lproc_osc.c +++ b/fs/lustre/osc/lproc_osc.c @@ -695,18 +695,17 @@ 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; len = lprocfs_climp_check(obd); if (len) return len; - 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)); up_read(&obd->u.cli.cl_sem); return len; @@ -717,8 +716,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; @@ -733,22 +731,10 @@ static ssize_t grant_shrink_store(struct kobject *kobj, struct attribute *attr, if (rc) return rc; - 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); up_read(&dev->u.cli.cl_sem); diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c index 9c43756..39cac7d 100644 --- a/fs/lustre/osc/osc_request.c +++ b/fs/lustre/osc/osc_request.c @@ -844,8 +844,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (!client->cl_import) return 0; - if ((client->cl_import->imp_connect_data.ocd_connect_flags & - OBD_CONNECT_GRANT_SHRINK) == 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) {