From patchwork Wed Nov 8 14:59:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10048641 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 41B2D60381 for ; Wed, 8 Nov 2017 15:00:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3897629341 for ; Wed, 8 Nov 2017 15:00:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D6D72A635; Wed, 8 Nov 2017 15:00:26 +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 F046A29341 for ; Wed, 8 Nov 2017 15:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752620AbdKHPAY (ORCPT ); Wed, 8 Nov 2017 10:00:24 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:49510 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbdKHPAX (ORCPT ); Wed, 8 Nov 2017 10:00:23 -0500 Received: by mail-it0-f66.google.com with SMTP id y15so7128915ita.4 for ; Wed, 08 Nov 2017 07:00:22 -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=RmV+Y8XfLV+l3jL2DnGBRgsaUTOkUWSgaB0eLfUAyTA=; b=Sj/Q/cPjBK9BOvZZrdUoAiX9+X1cOfJTL0FMeFhAnxlI1NR9GImBxnYxvSMGz/HGjR ryNx28+ECY5gfpyIVM0k4JXHVp1/P7YsQv0rfaMP7Dqk6bY4G8tYEFFhk7ezzWGFmrEc EzlcLHdly+fOZBmqdkqh7c/hyQWVvjWvUoHzlv/fSMVNTGpZts5fsbb5zRo/XCmNBsbG 8Jjy18aBnrsp0AeV3fR6Q42odaNhUibRdTX7bar5Iizw1dyMvdCTxN94ggeO9nYrC7Yj MgaMKC15Fbl7QUFXfPOUEk/QLBstJgXfZoolghv2nu9BejQ5YzQG5B57phLB4V3o6YXF zTng== 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=RmV+Y8XfLV+l3jL2DnGBRgsaUTOkUWSgaB0eLfUAyTA=; b=WaYCifJ6wBil8u19jhTECjmoNBieTHrw+fr8skmdk0EJ17guTgirGzkI39fmEzViSB qiejIKCpjP6tA1rseu1JGrwrrUgHuWAN1NFDmGUuXLMTdMHR+yAzaCJHitschkFsaKE0 IUbTgKnQYHHEtUJlYdecVGgmirJCK9D8F/aUF6SMRLVKCPcGA7bTVXWWJXERR+F35e6j nAXhU+TwMwLuGeKBc+O8oDOWpmKq6mf8lsg0AgRHSYyBoBFtGBcmiyfgT253mi2zCom0 i3gRwFjXWDT4k4kgUGNOfIzPrUoVMVH1zWZPBrLlS9iZZijSYM34D3E/PsIQLKIszhcA 37GA== X-Gm-Message-State: AJaThX525bper+OnWgQTtzjZ7klaumVWOX4MvEMpCBrd/9TEk23dh9ap zStnRo7BNRtMr4JeMQoEQtM= X-Google-Smtp-Source: ABhQp+TV1CEAnuO8DUToSRLOIA0MPt6frBfHT7j1YuGlZBROKCgwF8RDMxOu0Y/6ciiOdPNb82R7vQ== X-Received: by 10.36.250.10 with SMTP id v10mr1002469ith.117.1510153222421; Wed, 08 Nov 2017 07:00:22 -0800 (PST) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id q191sm9170077itb.1.2017.11.08.07.00.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Nov 2017 07:00:21 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: NeilBrown , Jeff Layton , Trond Myklebust Cc: linux-nfs@vger.kernel.org, Al Viro , "J . Bruce Fields" , David Howells , Joshua Watt Subject: [RFC 4/4] NFS: Add forcekill mount option Date: Wed, 8 Nov 2017 08:59:42 -0600 Message-Id: <20171108145942.5127-5-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171108145942.5127-1-JPEWhacker@gmail.com> References: <20171108145942.5127-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 Specifying the forcekill mount option causes umount() with the MNT_FORCE flag to not only kill all currently pending RPC tasks with -EIO, but also all future RPC tasks. This prevents the long delays caused by tasks queuing after rpc_killall_tasks() that can occur if the server drops off the network. Signed-off-by: Joshua Watt --- fs/nfs/super.c | 17 ++++++++++++++--- include/uapi/linux/nfs_mount.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 66fda2dcadd0..d972f6289aca 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -90,6 +90,7 @@ enum { Opt_resvport, Opt_noresvport, Opt_fscache, Opt_nofscache, Opt_migration, Opt_nomigration, + Opt_forcekill, Opt_noforcekill, /* Mount options that take integer arguments */ Opt_port, @@ -151,6 +152,8 @@ static const match_table_t nfs_mount_option_tokens = { { Opt_nofscache, "nofsc" }, { Opt_migration, "migration" }, { Opt_nomigration, "nomigration" }, + { Opt_forcekill, "forcekill" }, + { Opt_noforcekill, "noforcekill" }, { Opt_port, "port=%s" }, { Opt_rsize, "rsize=%s" }, @@ -637,6 +640,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" }, { NFS_MOUNT_UNSHARED, ",nosharecache", "" }, { NFS_MOUNT_NORESVPORT, ",noresvport", "" }, + { NFS_MOUNT_FORCEKILL, ",forcekill", ",noforcekill" }, { 0, NULL, NULL } }; const struct proc_nfs_info *nfs_infop; @@ -896,17 +900,18 @@ EXPORT_SYMBOL_GPL(nfs_show_stats); */ void nfs_umount_begin(struct super_block *sb) { - struct nfs_server *server; + struct nfs_server *server = NFS_SB(sb); struct rpc_clnt *rpc; + int kill_new_tasks = !!(server->flags & NFS_MOUNT_FORCEKILL); server = NFS_SB(sb); /* -EIO all pending I/O */ rpc = server->client_acl; if (!IS_ERR(rpc)) - rpc_killall_tasks(rpc, 0); + rpc_killall_tasks(rpc, kill_new_tasks); rpc = server->client; if (!IS_ERR(rpc)) - rpc_killall_tasks(rpc, 0); + rpc_killall_tasks(rpc, kill_new_tasks); } EXPORT_SYMBOL_GPL(nfs_umount_begin); @@ -1334,6 +1339,12 @@ static int nfs_parse_mount_options(char *raw, case Opt_nomigration: mnt->options &= ~NFS_OPTION_MIGRATION; break; + case Opt_forcekill: + mnt->flags |= NFS_MOUNT_FORCEKILL; + break; + case Opt_noforcekill: + mnt->flags &= ~NFS_MOUNT_FORCEKILL; + break; /* * options that take numeric values diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h index e44e00616ab5..66821542a38f 100644 --- a/include/uapi/linux/nfs_mount.h +++ b/include/uapi/linux/nfs_mount.h @@ -74,5 +74,6 @@ struct nfs_mount_data { #define NFS_MOUNT_LOCAL_FLOCK 0x100000 #define NFS_MOUNT_LOCAL_FCNTL 0x200000 +#define NFS_MOUNT_FORCEKILL 0x400000 #endif