]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
The bg option is essentially ignored with nfs4 currently. nfs4mount()
authorJeff Layton <jlaton@redhat.com>
Wed, 7 May 2008 14:35:30 +0000 (10:35 -0400)
committerSteve Dickson <steved@redhat.com>
Wed, 7 May 2008 14:35:30 +0000 (10:35 -0400)
will never exit with EX_BG, so the mount will never be backgrounded.
Fix it so that when bg is specified that we error out with EX_BG as
soon as possible after the first failed mount attempt.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/nfs4mount.c

index af70551f595e696a01a2a9bfbe98a53a1f87736d..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);
@@ -443,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);