]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfsmount.c
Change the append_addr_option() function to support sending either IPv4
[nfs-utils.git] / utils / mount / nfsmount.c
index 6c0c3655b5c23768825c812fc99b13cf043712ec..b343a1f07a216643f11a5ef3aec9614735a31014 100644 (file)
@@ -67,6 +67,7 @@
 #include "nls.h"
 #include "error.h"
 #include "network.h"
+#include "version.h"
 
 #ifndef NFS_PORT
 #define NFS_PORT 2049
@@ -95,8 +96,6 @@ extern char *progname;
 extern int verbose;
 extern int sloppy;
 
-extern int linux_version_code(void);
-
 static inline enum clnt_stat
 nfs3_mount(CLIENT *clnt, mnt3arg_t *mnt3arg, mnt3res_t *mnt3res)
 {
@@ -494,7 +493,6 @@ int
 nfsmount(const char *spec, const char *node, int flags,
         char **extra_opts, int fake, int running_bg)
 {
-       static char *prev_bg_host;
        char hostdir[1024];
        char *hostname, *dirname, *old_opts, *mounthost = NULL;
        char new_opts[1024], cbuf[1024];
@@ -571,7 +569,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 +583,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"),
@@ -624,18 +626,6 @@ nfsmount(const char *spec, const char *node, int flags,
        if (flags & MS_REMOUNT)
                goto out_ok;
 
-       /*
-        * If the previous mount operation on the same host was
-        * backgrounded, and the "bg" for this mount is also set,
-        * give up immediately, to avoid the initial timeout.
-        */
-       if (bg && !running_bg &&
-           prev_bg_host && strcmp(hostname, prev_bg_host) == 0) {
-               if (retry > 0)
-                       retval = EX_BG;
-               return retval;
-       }
-
        /* create mount deamon client */
 
        /*
@@ -704,7 +694,6 @@ nfsmount(const char *spec, const char *node, int flags,
                        continue;
                }
                if (!running_bg) {
-                       prev_bg_host = xstrdup(hostname);
                        if (retry > 0)
                                retval = EX_BG;
                        goto fail;
@@ -818,7 +807,7 @@ noauth_flavors:
         * to avoid problems with multihomed hosts.
         * --Swen
         */
-       if (linux_version_code() <= 0x01030a && fsock != -1
+       if (linux_version_code() <= MAKE_VERSION(1, 3, 10) && fsock != -1
            && connect(fsock, (struct sockaddr *) nfs_saddr,
                       sizeof (*nfs_saddr)) < 0) {
                perror(_("nfs connect"));