Skip to contentSkip to conversation

nfs-utils: NFSv4: fix backgrounding

PATCH In review Harshula Jayasuriya 2 participants 2 messages Nov 5, 2009 – Nov 16, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs-utils: NFSv4: fix backgrounding

Hi,

The nfsmount() function checks if !bg before running switch(rpc_createerr.cf_stat). On the other hand, the nfs4mount() function does not, and results in exiting the loop on the first iteration even with the bg mount option.

NOTE: This and the previous patch ("nfs-utils: mount options can be lost when using bg option") are relevant to non text-based mount options.

See https://bugzilla.redhat.com/show_bug.cgi?id=529370 for details.

---
 utils/mount/nfs4mount.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)
utils/mount/nfs4mount.c +15 -10
index a2f318f..4a2fab7 100644
@@ -217,8 +217,11 @@ int nfs4mount(const char *spec, const char *node, int flags,
 				progname);
 		goto fail;
 	}
-	snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
-		 old_opts, *old_opts ? "," : "", s);
+	if (running_bg)
+		strncpy(new_opts, old_opts, sizeof(new_opts));
+	else
+		snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
+			 old_opts, *old_opts ? "," : "", s);
 	*extra_opts = xstrdup(new_opts);
 
 	/* Set default options.
@@ -434,15 +437,17 @@ int nfs4mount(const char *spec, const char *node, int flags,
 			break;
 		}
 
-		switch(rpc_createerr.cf_stat){
-		case RPC_TIMEDOUT:
-			break;
-		case RPC_SYSTEMERROR:
-			if (errno == ETIMEDOUT)
+		if (!bg) {
+			switch(rpc_createerr.cf_stat) {
+			case RPC_TIMEDOUT:
 				break;
-		default:
-			rpc_mount_errors(hostname, 0, bg);
-			goto fail;
+			case RPC_SYSTEMERROR:
+				if (errno == ETIMEDOUT)
+					break;
+			default:
+				rpc_mount_errors(hostname, 0, bg);
+				goto fail;
+			}
 		}
 
 		if (bg && !running_bg) {

--

cya,
#

A message that is not in the archive (sent off-list or not yet received): 1257435088.2984.66.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#2 lore raw
Quoted 7 lines · Harshula Jayasuriya

Hi,

The nfsmount() function checks if !bg before running switch(rpc_createerr.cf_stat). On the other hand, the nfs4mount() function does not, and results in exiting the loop on the first iteration even with the bg mount option.

Quoted 6 lines

NOTE: This and the previous patch ("nfs-utils: mount options can be lost when using bg option") are relevant to non text-based mount options.

See https://bugzilla.redhat.com/show_bug.cgi?id=529370 for details.

Committed...

steved.