]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Assume v2/v3 if mount-related options are present
authorChuck Lever <chuck.lever@oracle.com>
Mon, 16 Nov 2009 17:53:01 +0000 (12:53 -0500)
committerSteve Dickson <steved@redhat.com>
Mon, 16 Nov 2009 17:53:01 +0000 (12:53 -0500)
Don't try NFSv4 if any MNT protocol related options were
presented by the user.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/stropts.c

index b5956495eeebf164638d9613102faf81e503a4a5..a0b9e7fdf80a0f8967bda37c05b1ee34444769a0 100644 (file)
@@ -611,6 +611,18 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
        }
 
        if (mi->version == 0) {
+               if (po_contains(options, "mounthost") ||
+                       po_contains(options, "mountaddr") ||
+                       po_contains(options, "mountvers") ||
+                       po_contains(options, "mountproto")) {
+               /*
+                * Since these mountd options are set assume version 3
+                * is wanted so error out with EPROTONOSUPPORT so the
+                * protocol negation starts with v3.
+                */
+                       errno = EPROTONOSUPPORT;
+                       goto out_fail;
+               }
                if (po_append(options, "vers=4") == PO_FAILED) {
                        errno = EINVAL;
                        goto out_fail;