Blob Blame History Raw
autofs-5.1.7 - reduce umount EBUSY check delay

From: Ian Kent <raven@themaw.net>

Some time ago I had to wait and retry umount() for autofs mounts
becuase I found EBUSY would be returned for a time after the call
causing false negative umount returns.

I think that problem has been resolved but removing the retry is
probably a little risky.

But the wait time is quite long at one fifth of a second so reduce
that to one twentieth of a second and increase the retries to make
it more resposive.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 daemon/direct.c     |    4 ++--
 daemon/indirect.c   |    2 +-
 include/automount.h |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index b144f6aa..6419052d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,7 @@
 - eliminate count_mounts() from expire_proc_indirect().
 - eliminate some strlen calls in offset handling.
 - don't add offset mounts to mounted mounts table.
+- reduce umount EBUSY check delay.
 
 25/01/2021 autofs-5.1.7
 - make bind mounts propagation slave by default.
diff --git a/daemon/direct.c b/daemon/direct.c
index fbfebbdd..5c1146a7 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -150,7 +150,7 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mapent *me)
 
 	retries = UMOUNT_RETRIES;
 	while ((rv = umount(me->key)) == -1 && retries--) {
-		struct timespec tm = {0, 200000000};
+		struct timespec tm = {0, 50000000};
 		if (errno != EBUSY)
 			break;
 		nanosleep(&tm, NULL);
@@ -573,7 +573,7 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
 
 	retries = UMOUNT_RETRIES;
 	while ((rv = umount(me->key)) == -1 && retries--) {
-		struct timespec tm = {0, 200000000};
+		struct timespec tm = {0, 50000000};
 		if (errno != EBUSY)
 			break;
 		nanosleep(&tm, NULL);
diff --git a/daemon/indirect.c b/daemon/indirect.c
index eddcfff7..9f2ca6a0 100644
--- a/daemon/indirect.c
+++ b/daemon/indirect.c
@@ -265,7 +265,7 @@ int umount_autofs_indirect(struct autofs_point *ap, const char *root)
 
 	retries = UMOUNT_RETRIES;
 	while ((rv = umount(mountpoint)) == -1 && retries--) {
-		struct timespec tm = {0, 200000000};
+		struct timespec tm = {0, 50000000};
 		if (errno != EBUSY)
 			break;
 		nanosleep(&tm, NULL);
diff --git a/include/automount.h b/include/automount.h
index 69445b92..fa6f5d63 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -140,7 +140,7 @@ struct autofs_point;
 #define NULL_MAP_HASHSIZE	64
 #define NEGATIVE_TIMEOUT	10
 #define POSITIVE_TIMEOUT	120
-#define UMOUNT_RETRIES		8
+#define UMOUNT_RETRIES		16
 #define EXPIRE_RETRIES		3
 
 struct mapent_cache {