Blame SOURCES/autofs-5.1.8-dont-immediately-call-function-when-waiting.patch

b5bc38
autofs-5.1.8 - dont immediately call function when waiting
b5bc38
b5bc38
From: Ian Kent <raven@themaw.net>
b5bc38
b5bc38
When autofs needs to wait for a sss connection the connection function
b5bc38
is immediately called a second time without first waiting. Adjust the
b5bc38
calling so that there's a wait before the next call.
b5bc38
b5bc38
Signed-off-by: Ian Kent <raven@themaw.net>
b5bc38
---
b5bc38
 CHANGELOG            |    1 +
b5bc38
 modules/lookup_sss.c |   24 ++++++++++++------------
b5bc38
 2 files changed, 13 insertions(+), 12 deletions(-)
b5bc38
b5bc38
--- autofs-5.1.4.orig/CHANGELOG
b5bc38
+++ autofs-5.1.4/CHANGELOG
b5bc38
@@ -107,6 +107,7 @@
b5bc38
 - fix incorrect path for is_mounted() in try_remount().
b5bc38
 - fail on empty replicated host name.
b5bc38
 - improve handling of ENOENT in sss setautomntent().
b5bc38
+- don't immediately call function when waiting.
b5bc38
 
b5bc38
 xx/xx/2018 autofs-5.1.5
b5bc38
 - fix flag file permission.
b5bc38
--- autofs-5.1.4.orig/modules/lookup_sss.c
b5bc38
+++ autofs-5.1.4/modules/lookup_sss.c
b5bc38
@@ -338,10 +338,13 @@ static int setautomntent_wait(unsigned i
b5bc38
 	     "can't connect to sssd, retry for %d seconds",
b5bc38
 	     retries);
b5bc38
 
b5bc38
-	while (++retry <= retries) {
b5bc38
+	while (++retry < retries) {
b5bc38
 		struct timespec t = { SSS_WAIT_INTERVAL, 0 };
b5bc38
 		struct timespec r;
b5bc38
 
b5bc38
+		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
+			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
+
b5bc38
 		ret = ctxt->setautomntent(ctxt->mapname, sss_ctxt);
b5bc38
 		if (proto_version(ctxt) == 0) {
b5bc38
 			if (ret != ENOENT)
b5bc38
@@ -355,9 +358,6 @@ static int setautomntent_wait(unsigned i
b5bc38
 			free(*sss_ctxt);
b5bc38
 			*sss_ctxt = NULL;
b5bc38
 		}
b5bc38
-
b5bc38
-		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
-			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
 	}
b5bc38
 
b5bc38
 	if (!ret)
b5bc38
@@ -475,10 +475,13 @@ static int getautomntent_wait(unsigned i
b5bc38
 	 "can't contact sssd to to get map entry, retry for %d seconds",
b5bc38
 	 retries);
b5bc38
 
b5bc38
-	while (++retry <= retries) {
b5bc38
+	while (++retry < retries) {
b5bc38
 		struct timespec t = { SSS_WAIT_INTERVAL, 0 };
b5bc38
 		struct timespec r;
b5bc38
 
b5bc38
+		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
+			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
+
b5bc38
 		ret = ctxt->getautomntent_r(key, value, sss_ctxt);
b5bc38
 		if (proto_version(ctxt) == 0) {
b5bc38
 			if (ret != ENOENT)
b5bc38
@@ -487,9 +490,6 @@ static int getautomntent_wait(unsigned i
b5bc38
 			if (ret != EHOSTDOWN)
b5bc38
 				break;
b5bc38
 		}
b5bc38
-
b5bc38
-		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
-			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
 	}
b5bc38
 
b5bc38
 	if (!ret)
b5bc38
@@ -600,10 +600,13 @@ static int getautomntbyname_wait(unsigne
b5bc38
 	"can't contact sssd to to lookup key value, retry for %d seconds",
b5bc38
 	retries);
b5bc38
 
b5bc38
-	while (++retry <= retries) {
b5bc38
+	while (++retry < retries) {
b5bc38
 		struct timespec t = { SSS_WAIT_INTERVAL, 0 };
b5bc38
 		struct timespec r;
b5bc38
 
b5bc38
+		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
+			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
+
b5bc38
 		ret = ctxt->getautomntbyname_r(key, value, sss_ctxt);
b5bc38
 		if (proto_version(ctxt) == 0) {
b5bc38
 			if (ret != ENOENT)
b5bc38
@@ -612,9 +615,6 @@ static int getautomntbyname_wait(unsigne
b5bc38
 			if (ret != EHOSTDOWN)
b5bc38
 				break;
b5bc38
 		}
b5bc38
-
b5bc38
-		while (nanosleep(&t, &r) == -1 && errno == EINTR)
b5bc38
-			memcpy(&t, &r, sizeof(struct timespec));
b5bc38
 	}
b5bc38
 
b5bc38
 	if (!ret)