From patchwork Fri Nov 10 22:37:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10053903 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 C6C8E6032D for ; Fri, 10 Nov 2017 22:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAD5F223C6 for ; Fri, 10 Nov 2017 22:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF7812B4BB; Fri, 10 Nov 2017 22:37:40 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 38461223C6 for ; Fri, 10 Nov 2017 22:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754730AbdKJWhi (ORCPT ); Fri, 10 Nov 2017 17:37:38 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:36643 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754604AbdKJWhg (ORCPT ); Fri, 10 Nov 2017 17:37:36 -0500 Received: by mail-it0-f68.google.com with SMTP id f187so3406966itb.1 for ; Fri, 10 Nov 2017 14:37:36 -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=8//hQlOD6c0gYQ/5Y4V/rC3BrCkt+8vwQkA5hkvD4e4=; b=E/5icM5SMJ0IXugY2vYofOJBtemxXLoZLmVthUKblPivSCJ1lvu1VEDOAMZTyPppob gEp+KZDUg1YB418LzTiD9oOkQTsUIIQZFpxbv9lPNKBR7WAKWypVJ3a0zkDL0JFmMdvy vh4ke/GkLsAnCd2XpdAi72A0QHxfh7+yMeM5Ir1/wRbU+WPTkqRzvampP/sxv6qebwTr Jn9SMSU++EhFpfPlnnqyCWrzW3o2BtOgoll1hKjb8pL8l+ZjI/NnuvtlVENkKx+rPjh9 kKCTcSvew9Qoq1L3TuCrfXFOcLIw2FHE12LvvGbycY55FidLbNK3+LJW9ZOa/B8xa2Uy sy0w== 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=8//hQlOD6c0gYQ/5Y4V/rC3BrCkt+8vwQkA5hkvD4e4=; b=e3rGSrHn7HT86KkEFgwb+QvIXAdACY7sOqvMDtYLKcZSsNoBm7wklMzRtAXxT6QG5l tfF3E834J5m8Q9qGlW2dAV9P+NqgDty3CaVVWo83i+CNlMSoVe614CkpoA4V/Eyfx9nh OJaD4ocl4HhNOmDRAYjylDhda4VAMxp8EnmVSZ8ZXoJgIcN9ni50dX24mdud2qh8hC/B Xn2XqfplWg7BE9UU60TVJXhGZyYAEATtPk88+gM64F0+gxA3E/mnII1vsopYmlF4gTpE TdDnJGpTpu4JgzKDFxhrRpYSH7m4zMSTeUGOwkmg+NupQlBHsEMUdnOSNLw/mdsX973C c7uQ== X-Gm-Message-State: AJaThX6x+/spYvayyHwke0n5l5Z1RfmFQQgVVWDK7SBK5roolmP6f6GX 8FDbzwL0aiBv/lpWqqNo95g= X-Google-Smtp-Source: AGs4zMaLZa6kckR1GwKZ+gBRRLPKt6AeXuhwKJTrQV5eVtl/LLujKv0xsRUzxdS5+WV9TSGI2Opbfg== X-Received: by 10.36.237.134 with SMTP id r128mr2333953ith.100.1510353455974; Fri, 10 Nov 2017 14:37:35 -0800 (PST) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id f3sm5001090iob.70.2017.11.10.14.37.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 14:37:35 -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 v2 4/7] NFS: Add mount flags mask Date: Fri, 10 Nov 2017 16:37:04 -0600 Message-Id: <20171110223707.17098-5-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171110223707.17098-1-JPEWhacker@gmail.com> References: <20171110223707.17098-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 Track which mount options were specified so that only the flags that actually changed will be updated when remounting. Signed-off-by: Joshua Watt --- fs/nfs/internal.h | 1 + fs/nfs/super.c | 58 ++++++++++++++++++++++++++----------------------------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index f9a4a5524bd5..f4308b730c1c 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -90,6 +90,7 @@ struct nfs_client_initdata { */ struct nfs_parsed_mount_data { int flags; + int flags_mask; unsigned int rsize, wsize; unsigned int timeo, retrans; unsigned int acregmin, acregmax, diff --git a/fs/nfs/super.c b/fs/nfs/super.c index cf6de998294d..777a0cc22704 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1197,6 +1197,16 @@ static int nfs_get_option_ul_bound(substring_t args[], unsigned long *option, return 0; } +static void +set_flag(struct nfs_parsed_mount_data *mnt, int flag, bool set) +{ + mnt->flags_mask |= flag; + if (set) + mnt->flags |= flag; + else + mnt->flags &= ~flag; +} + /* * Error-check and convert a string of mount options from user space into * a data structure. The whole mount string is processed; bad options are @@ -1248,75 +1258,61 @@ static int nfs_parse_mount_options(char *raw, * boolean options: foo/nofoo */ case Opt_soft: - mnt->flags |= NFS_MOUNT_SOFT; - break; case Opt_hard: - mnt->flags &= ~NFS_MOUNT_SOFT; + set_flag(mnt, NFS_MOUNT_SOFT, token == Opt_soft); break; case Opt_posix: - mnt->flags |= NFS_MOUNT_POSIX; - break; case Opt_noposix: - mnt->flags &= ~NFS_MOUNT_POSIX; + set_flag(mnt, NFS_MOUNT_POSIX, token == Opt_posix); break; case Opt_cto: - mnt->flags &= ~NFS_MOUNT_NOCTO; - break; case Opt_nocto: - mnt->flags |= NFS_MOUNT_NOCTO; + set_flag(mnt, NFS_MOUNT_NOCTO, token == Opt_nocto); break; case Opt_ac: - mnt->flags &= ~NFS_MOUNT_NOAC; - break; case Opt_noac: - mnt->flags |= NFS_MOUNT_NOAC; + set_flag(mnt, NFS_MOUNT_NOAC, token == Opt_noac); break; case Opt_lock: - mnt->flags &= ~NFS_MOUNT_NONLM; - mnt->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | - NFS_MOUNT_LOCAL_FCNTL); - break; case Opt_nolock: - mnt->flags |= NFS_MOUNT_NONLM; - mnt->flags |= (NFS_MOUNT_LOCAL_FLOCK | - NFS_MOUNT_LOCAL_FCNTL); + set_flag(mnt, NFS_MOUNT_NONLM | NFS_MOUNT_LOCAL_FLOCK | + NFS_MOUNT_LOCAL_FCNTL, + token == Opt_nolock); break; case Opt_udp: mnt->flags &= ~NFS_MOUNT_TCP; + mnt->flags_mask |= NFS_MOUNT_TCP; mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; break; case Opt_tcp: mnt->flags |= NFS_MOUNT_TCP; + mnt->flags_mask |= NFS_MOUNT_TCP; mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; break; case Opt_rdma: mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */ + mnt->flags_mask |= NFS_MOUNT_TCP; mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; xprt_load_transport(p); break; case Opt_acl: - mnt->flags &= ~NFS_MOUNT_NOACL; - break; case Opt_noacl: - mnt->flags |= NFS_MOUNT_NOACL; + set_flag(mnt, NFS_MOUNT_NOACL, token == Opt_noacl); break; case Opt_rdirplus: - mnt->flags &= ~NFS_MOUNT_NORDIRPLUS; - break; case Opt_nordirplus: - mnt->flags |= NFS_MOUNT_NORDIRPLUS; + set_flag(mnt, NFS_MOUNT_NORDIRPLUS, + token == Opt_nordirplus); break; case Opt_sharecache: - mnt->flags &= ~NFS_MOUNT_UNSHARED; - break; case Opt_nosharecache: - mnt->flags |= NFS_MOUNT_UNSHARED; + set_flag(mnt, NFS_MOUNT_UNSHARED, + token == Opt_nosharecache); break; case Opt_resvport: - mnt->flags &= ~NFS_MOUNT_NORESVPORT; - break; case Opt_noresvport: - mnt->flags |= NFS_MOUNT_NORESVPORT; + set_flag(mnt, NFS_MOUNT_NORESVPORT, + token == Opt_noresvport); break; case Opt_fscache: mnt->options |= NFS_OPTION_FSCACHE;