diff mbox

mount.nfs: Ensure parent mount of background mounts timeout

Message ID 1394204684-1283-1-git-send-email-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson March 7, 2014, 3:04 p.m. UTC
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

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/stropts.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index a642394..417d022 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -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;