walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
85ed8ab
commit 281ca299724f24e7b19c1eca04bba03410e2a306
85ed8ab
Author: Jeff Layton <jlaton@redhat.com>
85ed8ab
Date:   Wed May 7 10:35:30 2008 -0400
85ed8ab
85ed8ab
    The bg option is essentially ignored with nfs4 currently. nfs4mount()
85ed8ab
    will never exit with EX_BG, so the mount will never be backgrounded.
85ed8ab
    Fix it so that when bg is specified that we error out with EX_BG as
85ed8ab
    soon as possible after the first failed mount attempt.
85ed8ab
    
85ed8ab
    Signed-off-by: Jeff Layton <jlayton@redhat.com>
85ed8ab
    Signed-off-by: Steve Dickson <steved@redhat.com>
85ed8ab
85ed8ab
diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c
85ed8ab
index af70551..2b0fe2e 100644
85ed8ab
--- a/utils/mount/nfs4mount.c
85ed8ab
+++ b/utils/mount/nfs4mount.c
85ed8ab
@@ -188,10 +188,9 @@ int nfs4mount(const char *spec, const char *node, int flags,
85ed8ab
 	int bg, soft, intr;
85ed8ab
 	int nocto, noac, unshared;
85ed8ab
 	int retry;
85ed8ab
-	int retval;
85ed8ab
+	int retval = EX_FAIL;
85ed8ab
 	time_t timeout, t;
85ed8ab
 
85ed8ab
-	retval = EX_FAIL;
85ed8ab
 	if (strlen(spec) >= sizeof(hostdir)) {
85ed8ab
 		nfs_error(_("%s: excessively long host:dir argument\n"),
85ed8ab
 				progname);
85ed8ab
@@ -443,6 +442,13 @@ int nfs4mount(const char *spec, const char *node, int flags,
85ed8ab
 			rpc_mount_errors(hostname, 0, bg);
85ed8ab
 			goto fail;
85ed8ab
 		}
85ed8ab
+
85ed8ab
+		if (bg && !running_bg) {
85ed8ab
+			if (retry > 0)
85ed8ab
+				retval = EX_BG;
85ed8ab
+			goto fail;
85ed8ab
+		}
85ed8ab
+
85ed8ab
 		t = time(NULL);
85ed8ab
 		if (t >= timeout) {
85ed8ab
 			rpc_mount_errors(hostname, 0, bg);