All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Steve Dickson <steved@redhat.com>,
	Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH V2] mount.nfs: Use default minor version when -t nfs4 is specified
Date: Fri, 09 Jun 2017 16:20:17 +1000	[thread overview]
Message-ID: <87a85hadi6.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170608183314.15247-1-steved@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2604 bytes --]

On Thu, Jun 08 2017, Steve Dickson wrote:

> When the nfs4 filesystem specified, the default major
> and minor versions should be used.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>

Hi Steve,
 I think this is definitely heading in the right direction.
 I particularly like that you've #defined for the default major/minor.

 However as I reflected on it, I realised that "-o v4" needs to set
 the same version as "-t nfs4", and even with this patch it doesn't.

 I think we need to focus on nfs_default_version() and make sure it does
 the right thing.

 If v.mode == V_DEFAULT, we need to copy both 'major' and 'minor'
 from config_default_vers if they are set.  If
 config_default_vers.v_mode == V_GENERAL, .minor won't be set so in
 that case we need to use NFS_DEFAULT_MINOR;

 If v.mode == V_GENERAL, then only copy the minor if it is set and the
 major is correct.  So we need to check for V_SPECIFIC, and other wise
 use the default minor.

 If v.mode == V_SPECIFIC, nfs_default_version isn't called, so it
 doesn't matter.

 I think this gets it right...

 Thoughts?

Thanks,
NeilBrown

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index c0266e51ad1c..7dfdd9e62115 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -73,6 +73,13 @@
 #define NFS_DEF_BG_TIMEOUT_MINUTES	(10000u)
 #endif
 
+#ifndef NFS_DEFAULT_MAJOR
+#define NFS_DEFAULT_MAJOR	4
+#endif
+#ifndef NFS_DEFAULT_MINOR
+#define NFS_DEFAULT_MINOR	2
+#endif
+
 extern int nfs_mount_data_version;
 extern char *progname;
 extern int verbose;
@@ -110,22 +117,27 @@ static void nfs_default_version(struct nfsmount_info *mi)
 	}
 
 	if (mi->version.v_mode == V_DEFAULT &&
-		config_default_vers.v_mode != V_DEFAULT) {
+	    config_default_vers.v_mode != V_DEFAULT) {
 		mi->version.major = config_default_vers.major;
-		mi->version.minor = config_default_vers.minor;
+		if (config_default_vers.v_mode == V_SPECIFIC)
+			mi->version.minor = config_default_vers.minor;
+		else
+			mi->version.minor = NFS_DEFAULT_MINOR;
 		return;
 	}
 
 	if (mi->version.v_mode == V_GENERAL) {
-		if (config_default_vers.v_mode != V_DEFAULT &&
+		if (config_default_vers.v_mode == V_SPECIFIC &&
 		    mi->version.major == config_default_vers.major)
 			mi->version.minor = config_default_vers.minor;
+		else
+			mi->version.minor = NFS_DEFAULT_MINOR;
 		return;
 	}
 
 #endif /* MOUNT_CONFIG */
-	mi->version.major = 4;
-	mi->version.minor = 2;
+	mi->version.major = NFS_DEFAULT_MAJOR;
+	mi->version.minor = NFS_DEFAULT_MINOR;
 }
 
 /*

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-06-09  6:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 18:33 [PATCH V2] mount.nfs: Use default minor version when -t nfs4 is specified Steve Dickson
2017-06-09  6:20 ` NeilBrown [this message]
2017-06-09 13:24   ` 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=87a85hadi6.fsf@notabene.neil.brown.name \
    --to=neilb@suse.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 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.