[PATCH] mount.nfs: Ensure parent mount of background mounts timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 utils/mount/stropts.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

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;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux