public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Steve Dickson <steved@redhat.com>
Cc: Justin Mitchell <jumitche@redhat.com>,
	Benjamin Coddington <bcodding@redhat.com>,
	linux-nfs@vger.kernel.org
Subject: [PATCH 3/7] Revert "mount.nfs: merge in vers= and nfsvers= options"
Date: Wed, 16 Dec 2020 15:43:03 +1100	[thread overview]
Message-ID: <160809378307.7232.12486406696809312958.stgit@noble> (raw)
In-Reply-To: <160809318571.7232.10427700322834760606.stgit@noble>

This reverts commit 8110103404b35d9e86057ef0764f8aa87585f455.

Using mnt_alias_tab[] to handle options which are synonyms isn't really
a good fit.  This sort-of works, but in part only because 'strstr()'
is used for matching so "vers=" is found when "nfsvers=" is present.
This doesn't handle other version-setting options like v2, v3, v4.x.

So remove this commit to make room for a better solution.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 utils/mount/configfile.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index 2470bc6a8bf6..e20aa73739fc 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -70,7 +70,6 @@ struct mnt_alias {
 	{"background", "bg", MNT_NOARG},
 	{"foreground", "fg", MNT_NOARG},
 	{"sloppy", "sloppy", MNT_NOARG},
-	{"nfsvers", "vers", MNT_UNSET},
 };
 int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0]));
 
@@ -296,21 +295,20 @@ conf_parse_mntopts(char *section, char *arg, char *opts)
 
 	list = conf_get_tag_list(section, arg);
 	TAILQ_FOREACH(node, &list->fields, link) {
-		/* check first if this is an alias for another option */
-		field = mountopts_alias(node->field, &argtype);
 		/*
 		 * Do not overwrite options if already exists
 		 */
-		snprintf(buf, BUFSIZ, "%s=", field);
+		snprintf(buf, BUFSIZ, "%s=", node->field);
 		if (opts && strcasestr(opts, buf) != NULL)
 			continue;
 
-		if (lookup_entry(field) != NULL)
+		if (lookup_entry(node->field) != NULL)
 			continue;
 		buf[0] = '\0';
 		value = conf_get_section(section, arg, node->field);
 		if (value == NULL)
 			continue;
+		field = mountopts_alias(node->field, &argtype);
 		if (strcasecmp(value, "false") == 0) {
 			if (argtype != MNT_NOARG)
 				snprintf(buf, BUFSIZ, "no%s", field);



  reply	other threads:[~2020-12-16  4:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16  4:43 [PATCH 0/7 nfs-utils] Assorted improvements to handling nfsmount.conf NeilBrown
2020-12-16  4:43 ` NeilBrown [this message]
2020-12-16  4:43 ` [PATCH 1/7] mount: configfile: remove whitesspace from end of lines NeilBrown
2020-12-16  4:43 ` [PATCH 6/7] mount: don't add config-file protcol version options when already present NeilBrown
2020-12-16  4:43 ` [PATCH 7/7] mount: update nfsmount.conf man page NeilBrown
2020-12-16  4:43 ` [PATCH 5/7] mount: options in config file shouldn't over-ride command-line options NeilBrown
2020-12-16  4:43 ` [PATCH 4/7] mount: convert configfile.c to use parse_opt.c NeilBrown
2020-12-16  4:43 ` [PATCH 2/7] mount: report error if multiple version specifiers are given NeilBrown
2020-12-17 15:11 ` [PATCH 0/7 nfs-utils] Assorted improvements to handling nfsmount.conf Steve Dickson

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=160809378307.7232.12486406696809312958.stgit@noble \
    --to=neilb@suse.de \
    --cc=bcodding@redhat.com \
    --cc=jumitche@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox