]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfsmount.c
The bg option is essentially ignored with nfs4 currently. nfs4mount()
[nfs-utils.git] / utils / mount / nfsmount.c
index d1d43c661e41555eb7ea6aa0448f69e5c8ffefb4..a9dd91764fbb7276521245885133c928640966f7 100644 (file)
@@ -479,7 +479,7 @@ static int nfsmnt_check_compat(const struct pmap *nfs_pmap,
        }
 
        if (mnt_pmap->pm_vers > max_mnt_vers) {
-               nfs_error(_("%s: NFS mount version %ld s not supported"),
+               nfs_error(_("%s: NFS mount version %ld is not supported"),
                                progname, mnt_pmap->pm_vers);
                goto out_bad;
        }
@@ -571,7 +571,7 @@ nfsmount(const char *spec, const char *node, int flags,
 #endif
 
        bg = 0;
-       retry = 10000;          /* 10000 minutes ~ 1 week */
+       retry = -1;
 
        memset(mnt_pmap, 0, sizeof(*mnt_pmap));
        mnt_pmap->pm_prog = MOUNTPROG;
@@ -585,9 +585,13 @@ nfsmount(const char *spec, const char *node, int flags,
                goto fail;
        if (!nfsmnt_check_compat(nfs_pmap, mnt_pmap))
                goto fail;
-       
-       if (retry == 10000 && !bg)
-               retry = 2; /* reset for fg mounts */
+
+       if (retry == -1) {
+               if (bg)
+                       retry = 10000;  /* 10000 mins == ~1 week*/
+               else
+                       retry = 2;      /* 2 min default on fg mounts */
+       }
 
 #ifdef NFS_MOUNT_DEBUG
        printf(_("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n"),
@@ -738,7 +742,7 @@ nfsmount(const char *spec, const char *node, int flags,
 #if NFS_MOUNT_VERSION >= 4
                mountres3_ok *mountres;
                fhandle3 *fhandle;
-               int i, *flavor, yum = 0;
+               int i,  n_flavors, *flavor, yum = 0;
                if (mntres.nfsv3.fhs_status != 0) {
                        nfs_error(_("%s: %s:%s failed, reason given by server: %s"),
                                        progname, hostname, dirname,
@@ -747,13 +751,16 @@ nfsmount(const char *spec, const char *node, int flags,
                }
 #if NFS_MOUNT_VERSION >= 5
                mountres = &mntres.nfsv3.mountres3_u.mountinfo;
-               i = mountres->auth_flavors.auth_flavors_len;
-               if (i <= 0)
+               n_flavors = mountres->auth_flavors.auth_flavors_len;
+               if (n_flavors <= 0)
                        goto noauth_flavors;
 
                flavor = mountres->auth_flavors.auth_flavors_val;
-               while (--i >= 0) {
-                       /* If no flavour requested, use first simple
+               for (i = 0; i < n_flavors; ++i) {
+                       /*
+                        * Per RFC2623, section 2.7, we should prefer the
+                        * flavour listed first.
+                        * If no flavour requested, use the first simple
                         * flavour that is offered.
                         */
                        if (! (data.flags & NFS_MOUNT_SECFLAVOUR) &&