From patchwork Thu Feb 27 21:09:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410259 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 03A08138D for ; Thu, 27 Feb 2020 21:33:42 +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 E02FA24677 for ; Thu, 27 Feb 2020 21:33:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E02FA24677 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 38C71349267; Thu, 27 Feb 2020 13:28:33 -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 CCEF821FAD5 for ; Thu, 27 Feb 2020 13:18:46 -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 66F6D1023; Thu, 27 Feb 2020 16:18:14 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 6572E46F; Thu, 27 Feb 2020 16:18:14 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:09:27 -0500 Message-Id: <1582838290-17243-100-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 099/622] lustre: osc: serialize access to idle_timeout vs cleanup 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: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Alex Zhuravlev use lprocfs_climp_check() and up_read() as cl_import can disappear due to umount. WC-bug-id: https://jira.whamcloud.com/browse/LU-11175 Lustre-commit: 5874da0b670b ("LU-11175 osc: serialize access to idle_timeout vs cleanup") Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/32883 Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- fs/lustre/osc/lproc_osc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c index 0a12079..efb4998 100644 --- a/fs/lustre/osc/lproc_osc.c +++ b/fs/lustre/osc/lproc_osc.c @@ -604,8 +604,15 @@ 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); + ret = lprocfs_climp_check(obd); + if (ret) + return ret; + ret = sprintf(buf, "%u\n", cli->cl_import->imp_idle_timeout); + up_read(&obd->u.cli.cl_sem); + + return ret; } static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, @@ -625,6 +632,10 @@ static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, if (val > CONNECTION_SWITCH_MAX) return -ERANGE; + rc = lprocfs_climp_check(obd); + if (rc) + return rc; + cli->cl_import->imp_idle_timeout = val; /* to initiate the connection if it's in IDLE state */ @@ -633,6 +644,7 @@ static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr, if (req) ptlrpc_req_finished(req); } + up_read(&obd->u.cli.cl_sem); return count; } @@ -645,12 +657,18 @@ static ssize_t idle_connect_store(struct kobject *kobj, struct attribute *attr, obd_kset.kobj); struct client_obd *cli = &dev->u.cli; struct ptlrpc_request *req; + int rc; + + rc = lprocfs_climp_check(dev); + if (rc) + return rc; /* 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); + up_read(&dev->u.cli.cl_sem); return count; }