]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfs4mount.c
Clean up: rename a couple of functions in utils/mount/stropts.c to match
[nfs-utils.git] / utils / mount / nfs4mount.c
index 311e5a07b0b04c6ac4c42ed84fb47e0ab7f29161..2b0fe2e30c50de63b1a2c92b2ef69440e6760c06 100644 (file)
@@ -188,10 +188,9 @@ int nfs4mount(const char *spec, const char *node, int flags,
        int bg, soft, intr;
        int nocto, noac, unshared;
        int retry;
-       int retval;
+       int retval = EX_FAIL;
        time_t timeout, t;
 
-       retval = EX_FAIL;
        if (strlen(spec) >= sizeof(hostdir)) {
                nfs_error(_("%s: excessively long host:dir argument\n"),
                                progname);
@@ -238,7 +237,7 @@ int nfs4mount(const char *spec, const char *node, int flags,
        nocto = 0;
        noac = 0;
        unshared = 0;
-       retry = 10000;          /* 10000 minutes ~ 1 week */
+       retry = -1;
 
        /*
         * NFSv4 specifies that the default port should be 2049
@@ -332,6 +331,14 @@ int nfs4mount(const char *spec, const char *node, int flags,
                }
        }
 
+       /* if retry is still -1, then it wasn't set via an option */
+       if (retry == -1) {
+               if (bg)
+                       retry = 10000;  /* 10000 mins == ~1 week */
+               else
+                       retry = 2;      /* 2 min default on fg mounts */
+       }
+
        data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
                | (intr ? NFS4_MOUNT_INTR : 0)
                | (nocto ? NFS4_MOUNT_NOCTO : 0)
@@ -435,6 +442,13 @@ int nfs4mount(const char *spec, const char *node, int flags,
                        rpc_mount_errors(hostname, 0, bg);
                        goto fail;
                }
+
+               if (bg && !running_bg) {
+                       if (retry > 0)
+                               retval = EX_BG;
+                       goto fail;
+               }
+
                t = time(NULL);
                if (t >= timeout) {
                        rpc_mount_errors(hostname, 0, bg);