From patchwork Fri Nov 17 17:45:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10063075 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4524C6023A for ; Fri, 17 Nov 2017 17:46:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 349032AD16 for ; Fri, 17 Nov 2017 17:46:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2975A2AD3A; Fri, 17 Nov 2017 17:46:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD49C2AD16 for ; Fri, 17 Nov 2017 17:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161128AbdKQRq0 (ORCPT ); Fri, 17 Nov 2017 12:46:26 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:42581 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161130AbdKQRqR (ORCPT ); Fri, 17 Nov 2017 12:46:17 -0500 Received: by mail-io0-f193.google.com with SMTP id u42so9529756ioi.9 for ; Fri, 17 Nov 2017 09:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b7BrQFxYM7xXt0ThkCM1JIFNvKCjLYzTDc7BoXJaMEY=; b=drQO3i47HoRKxtQxiQreMRf0v8CRI1nE3ynE1WHA5XFeoPTFyl+frUku/eV1e7nZBd jRzluo1yK86DrQYO97Y1sXKEeo2B5G4ewgNgI2OMOrdmC2XbiaiO6WrXNWdosLh8wNU7 pnozuChhjmC4ZeR0+3I68ciCEst4s0Z0P7BDggGlsRG/1Y+wNg4FsGXwwOasUYsp/+Sf 9l1y7ycbuWIN1A2uw+dQq6qFOB1HSqJ/sD2Sv2jziiSRNS+nIZnqpBoaRRZNYEgzazR8 qJ3esxLVg+dzDd6jCMWa5nnRw0iNnK4HZCTVeE692aetXFJVQlsmdOWnv6Ui+/67zJuM M0YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b7BrQFxYM7xXt0ThkCM1JIFNvKCjLYzTDc7BoXJaMEY=; b=jXZfYmKp4Ds3MYo5VkWyz94ppQL1tQH1/G91yUULpDYSM2QRg2YGcxqSFt1wpAh/f7 h+u+znavr1HNRcOjmy79b0r4yw9NmDIT5C2TiucSZp1wAcoRKIqlIEzL3SAmrMt8yfsD bANcGL36RzDqGVPX8HHeDJ+sbaiyLyV1hPzdbUimsowimMnp9HXV8b6P3Lp1i/BH/kLW 5gBn54PmF+4+fswspniM7Ma5QzS4Vi/8GbR02lppNabUofdSFxwAa7T55d1IoHFz1UUS y0dJ81QcXot81xzKsa0/3WHwDucDR2gLAr1XcWMdX+/a5AC46dP35XV+pQNtJ+cNh4VF 94Wg== X-Gm-Message-State: AJaThX4KwYhi5Zo4qgd4T30UStD/sMFBCOKNniAi/pulUYHYVLl7IIvy 6I69MSLfQ9OaC0PxGPP43/w= X-Google-Smtp-Source: AGs4zMYEnyk115cGN1ztxlHDt0PQLNTxFDUtjQemCEhxtYjO/Uj7OzHSLzV8vr4juYBBwa7+p1TGqw== X-Received: by 10.107.82.3 with SMTP id g3mr3555451iob.214.1510940777055; Fri, 17 Nov 2017 09:46:17 -0800 (PST) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id h21sm1878189iod.59.2017.11.17.09.46.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Nov 2017 09:46:16 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: NeilBrown , Jeff Layton , Trond Myklebust , "J . Bruce Fields" Cc: linux-nfs@vger.kernel.org, Al Viro , David Howells , Joshua Watt Subject: [RFC v4 9/9] NFS: Kill all client RPCs if transient Date: Fri, 17 Nov 2017 11:45:52 -0600 Message-Id: <20171117174552.18722-10-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171117174552.18722-1-JPEWhacker@gmail.com> References: <20171117174552.18722-1-JPEWhacker@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When unmounting with the MNT_FORCE flag, all client RPCs will be killed in all mount points if the mount is transient Signed-off-by: Joshua Watt --- fs/nfs/super.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 09c413c098ef..f97cec1a1dec 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -904,6 +904,18 @@ kill_rpc(struct rpc_clnt *rpc) } } +static void +kill_client_rpc(struct nfs_client *client) +{ + struct nfs_server *server; + + kill_rpc(client->cl_rpcclient); + list_for_each_entry_rcu(server, &client->cl_superblocks, client_link) { + kill_rpc(server->client_acl); + kill_rpc(server->client); + } +} + /* * Begin unmount by attempting to remove all automounted mountpoints we added * in response to xdev traversals and referrals @@ -914,8 +926,12 @@ void nfs_umount_begin(struct super_block *sb) server = NFS_SB(sb); /* -EIO all pending I/O */ - kill_rpc(server->client_acl); - kill_rpc(server->client); + if (server->flags & NFS_MOUNT_TRANSIENT) { + kill_client_rpc(server->nfs_client); + } else { + kill_rpc(server->client_acl); + kill_rpc(server->client); + } } EXPORT_SYMBOL_GPL(nfs_umount_begin); @@ -926,13 +942,29 @@ restore_rpc(struct rpc_clnt *rpc) __atomic_add_unless(&rpc->cl_kill_new_tasks, -1, 0); } +static void +restore_client_rpc(struct nfs_client *client) +{ + struct nfs_server *server; + + restore_rpc(client->cl_rpcclient); + list_for_each_entry_rcu(server, &client->cl_superblocks, client_link) { + restore_rpc(server->client_acl); + restore_rpc(server->client); + } +} + void nfs_umount_end(struct super_block *sb) { struct nfs_server *server = NFS_SB(sb); - restore_rpc(server->client_acl); - restore_rpc(server->client); + if (server->flags & NFS_MOUNT_TRANSIENT) { + restore_client_rpc(server->nfs_client); + } else { + restore_rpc(server->client_acl); + restore_rpc(server->client); + } } EXPORT_SYMBOL_GPL(nfs_umount_end);