From: Joshua Watt <jpewhacker@gmail.com>
To: NeilBrown <neilb@suse.com>, Jeff Layton <jlayton@redhat.com>,
Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
"J . Bruce Fields" <bfields@fieldses.org>,
David Howells <dhowells@redhat.com>,
Joshua Watt <JPEWhacker@gmail.com>
Subject: [RFC v2 4/7] NFS: Add mount flags mask
Date: Fri, 10 Nov 2017 16:37:04 -0600 [thread overview]
Message-ID: <20171110223707.17098-5-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20171110223707.17098-1-JPEWhacker@gmail.com>
Track which mount options were specified so that only the flags that
actually changed will be updated when remounting.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
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;
--
2.13.6
next prev parent reply other threads:[~2017-11-10 22:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 22:37 [RFC v2 0/7] NFS Force Unmounting Joshua Watt
2017-11-10 22:37 ` [RFC v2 1/7] SUNRPC: Add flag to kill new tasks Joshua Watt
2017-11-10 22:37 ` [RFC v2 2/7] SUNRPC: Expose kill_new_tasks in debugfs Joshua Watt
2017-11-10 22:37 ` [RFC v2 3/7] SUNRPC: Simplify client shutdown Joshua Watt
2017-11-10 22:37 ` Joshua Watt [this message]
2017-11-10 22:37 ` [RFC v2 5/7] NFS: Add serverfailed mount option Joshua Watt
2017-11-10 22:45 ` Chuck Lever
2017-11-13 16:29 ` Joshua Watt
2017-11-13 17:23 ` Chuck Lever
2017-11-10 22:37 ` [RFC v2 6/7] NFS: Propagate NFS_MOUNT_UNSHARED to clients Joshua Watt
2017-11-10 22:37 ` [RFC v2 7/7] NFS: Propagate operations to unshared clients Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171110223707.17098-5-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=bfields@fieldses.org \
--cc=dhowells@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.com \
--cc=trond.myklebust@primarydata.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.