Skip to contentSkip to conversation

mount.nfs: Ensure parent mount of background mounts timeout

PATCH New Steve Dickson 1 participant 1 message Mar 7, 2014

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

PATCH 1/1 mount.nfs: Ensure parent mount of background mounts timeout

With a proposed kernel fixed, the parent mounts of background mounts do not time out for over 5 mins.

This patch will append "retrans=1,timeo=100" to the mount options (when they don't exist) causing the parent mount to time out in ~25secs

The options are then removed (if they were added) before the child mount, in background, is done

---
 utils/mount/stropts.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
utils/mount/stropts.c +12 -0
index a642394..417d022 100644
@@ -921,6 +921,14 @@ static int nfsmount_fg(struct nfsmount_info *mi)
  */
 static int nfsmount_parent(struct nfsmount_info *mi)
 {
+	po_return_t retrans, timeo;
+
+	if (po_contains(mi->options, "retrans") == PO_NOT_FOUND)
+		retrans = po_append(mi->options, "retrans=1");
+
+	if (po_contains(mi->options, "timeo") == PO_NOT_FOUND)
+		timeo = po_append(mi->options, "timeo=100"); /* ~25 secs */
+
 	if (nfs_try_mount(mi))
 		return EX_SUCCESS;
 
@@ -929,6 +937,10 @@ static int nfsmount_parent(struct nfsmount_info *mi)
 		mount_error(mi->spec, mi->node, errno);
 		return EX_FAIL;
 	}
+	if (retrans == PO_SUCCEEDED)
+		po_remove_all(mi->options, "retrans");
+	if (timeo == PO_SUCCEEDED)
+		po_remove_all(mi->options, "timeo");
 
 	sys_mount_errors(mi->hostname, errno, 1, 1);
 	return EX_BG;
Signature · 1 line
1.7.1