Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1489066rwd; Thu, 15 Jun 2023 11:09:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5v7zm7+M4FIDKssg37sI1nyQ6GukqoVd3HkQe6YO1k9VnCr/Q4ZLxatG68BQiYUJM1OtE8 X-Received: by 2002:a17:902:7281:b0:1b2:1a79:9a67 with SMTP id d1-20020a170902728100b001b21a799a67mr14809946pll.50.1686852592511; Thu, 15 Jun 2023 11:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686852592; cv=none; d=google.com; s=arc-20160816; b=AQFvESgrMOGXgvgHw+6rPVcUpeE3Ss8BIT5jkwsh3cYpkjDsW6DJxiGKtYHmyKhhHS Xu6hppt0/XBsCCICnXivte1MnN9tZZZnaFTeVrpRwbeSSLftdqmI++4ysu0Ge8CliyWu N3uwVKG0eZ7ovXHKMMU0h2B4RZaA+oXEnZO4QRKVwdRxYYVQWMKMrmkWsh3SKsk7fg3H S4IWhojf8bi8/t6nfCflAVmrS7wiGOiS5BGJXDF5ibsh0MmDHQeH6ForBqWbrccrDzRR tGklG8WKd+8s14eFd32mgyg0GScioWJY8wTcsREbwFonByFHvBsm9Jk/Ay4NN7PvldFL XPsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=pW95zJ7Be7rHQC7EOLBUX6nGSxa8dostz7GgnMxRoUc=; b=Hi0GAd9PBw0p/w23HfBxq3rCp/4jAhZyh6eFMO27xLYttKPSTNLO7SCzc207Axdve7 Ls/4ZfNewm3jDYS9kKMKolNil9o8IR2kbnJBTArheYe2AJnF4vDptZalRmz/5LMO6HUD kxC2gzOzDCI2IvKdZ54jlMf3JWvK3BfaWkhZ+pgLjBCXQ3HeZDlMRWX6pjpRs6P20w6B Iuf+FwRbhzOzWNn9f25Y/tgtcpCL8oH3+Gk+XvDsI71h3tKnbkfU+Z14nsEIGDVL6gqP 5vuVz3DuKyseDpYhTwYhMGaLCL9US/pBKazPZpNEAOR39dz332YOD/eKQ4QpmLdP0cFH r3qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ftzOcCEX; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a170902d4d100b001b261eba754si3386280plg.165.2023.06.15.11.09.39; Thu, 15 Jun 2023 11:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ftzOcCEX; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236509AbjFOSJR (ORCPT + 99 others); Thu, 15 Jun 2023 14:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236693AbjFOSJF (ORCPT ); Thu, 15 Jun 2023 14:09:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C8C2967 for ; Thu, 15 Jun 2023 11:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686852459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pW95zJ7Be7rHQC7EOLBUX6nGSxa8dostz7GgnMxRoUc=; b=ftzOcCEXvohlL980/O/nLN9CGyV3I3+XFlUEBy+cbuJVh+TT/NDq0Pvk9P68L7Hvwbrjtw Wm5LAG6tVh/1ehPWg+XJ1ScAHjmbM1AUgAe/nNBwaK1p8zS3tm9iugHCPE72LBfYYET37a 4H4dmvE6RZOcecegNvkVC9JftlmPdSQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-84-uJz5xl95P0iZCr8CugVZyQ-1; Thu, 15 Jun 2023 14:07:37 -0400 X-MC-Unique: uJz5xl95P0iZCr8CugVZyQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 565D21C05146 for ; Thu, 15 Jun 2023 18:07:37 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.50.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 189612166B26 for ; Thu, 15 Jun 2023 18:07:37 +0000 (UTC) From: Benjamin Coddington To: linux-nfs@vger.kernel.org Subject: [PATCH v4 10/11] NFS: Cancel all existing RPC tasks when shutdown Date: Thu, 15 Jun 2023 14:07:31 -0400 Message-Id: <6f4beb04a12c061044451539ea4ff0ebb66a1352.1686851158.git.bcodding@redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Walk existing RPC tasks and cancel them with -EIO when the client is shutdown. Signed-off-by: Benjamin Coddington --- fs/nfs/sysfs.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c index 1fedbaff10e9..acda8f033d30 100644 --- a/fs/nfs/sysfs.c +++ b/fs/nfs/sysfs.c @@ -217,6 +217,17 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns) } } +static bool shutdown_match_client(const struct rpc_task *task, const void *data) +{ + return true; +} + +static void shutdown_client(struct rpc_clnt *clnt) +{ + clnt->cl_shutdown = 1; + rpc_cancel_tasks(clnt, -EIO, shutdown_match_client, NULL); +} + static ssize_t shutdown_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -247,14 +258,14 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr, goto out; server->flags |= NFS_MOUNT_SHUTDOWN; - server->client->cl_shutdown = 1; - server->nfs_client->cl_rpcclient->cl_shutdown = 1; + shutdown_client(server->client); + shutdown_client(server->nfs_client->cl_rpcclient); if (!IS_ERR(server->client_acl)) - server->client_acl->cl_shutdown = 1; + shutdown_client(server->client_acl); if (server->nlm_host) - server->nlm_host->h_rpcclnt->cl_shutdown = 1; + shutdown_client(server->nlm_host->h_rpcclnt); out: return count; } -- 2.40.1