Blame SOURCES/autofs-5.0.8-fix-inconsistent-error-returns-in-handle_packet_missing_direct.patch

6bbd11
autofs-5.0.8 - fix inconsistent error returns in handle_packet_missing_direct()
6bbd11
6bbd11
From: Ian Kent <raven@themaw.net>
6bbd11
6bbd11
How to handle mount requests that arrive during a shutdown is a big
6bbd11
problem.
6bbd11
6bbd11
Currently common cases result in the requesting process being sent a
6bbd11
fail status and success being returned to the calling autofs process.
6bbd11
6bbd11
There are a number of places where a fail is returned to the calling
6bbd11
process (such as memeory allocation errors) which should cause the
6bbd11
daemon to exit. But when a request arrives during a shutdown the
6bbd11
daemon is usually not ready to shutdown and instead performs recovery
6bbd11
and returns to a ready state instead of shutting down.
6bbd11
6bbd11
There were a few places in handle_packet_missing_direct() where a fail
6bbd11
was being returned when a success should have been returned which was
6bbd11
preventing the completion of the shutdown.
6bbd11
6bbd11
This is not ideal because during a restart of the daemon processes
6bbd11
requesting a mount could receive a mount failure. But this has been
6bbd11
the policy for while now and it's very difficult to do in a different
6bbd11
way.
6bbd11
---
6bbd11
 CHANGELOG       |    1 +
6bbd11
 daemon/direct.c |    6 +++---
6bbd11
 2 files changed, 4 insertions(+), 3 deletions(-)
6bbd11
6bbd11
--- autofs-5.0.7.orig/CHANGELOG
6bbd11
+++ autofs-5.0.7/CHANGELOG
6bbd11
@@ -98,6 +98,7 @@
6bbd11
 - fix fix map source with type lookup.
6bbd11
 - fix lookup_nss_mount() map lookup.
6bbd11
 - dont ignore null cache entries on multi mount umount.
6bbd11
+- fix inconsistent error returns in handle_packet_missing_direct().
6bbd11
 
6bbd11
 25/07/2012 autofs-5.0.7
6bbd11
 =======================
6bbd11
--- autofs-5.0.7.orig/daemon/direct.c
6bbd11
+++ autofs-5.0.7/daemon/direct.c
6bbd11
@@ -1384,7 +1384,7 @@ int handle_packet_missing_direct(struct
6bbd11
 		master_source_unlock(ap->entry);
6bbd11
 		master_mutex_unlock();
6bbd11
 		pthread_setcancelstate(state, NULL);
6bbd11
-		return 1;
6bbd11
+		return 0;
6bbd11
 	}
6bbd11
 
6bbd11
 	/* Check if we recorded a mount fail for this key */
6bbd11
@@ -1409,7 +1409,7 @@ int handle_packet_missing_direct(struct
6bbd11
 		master_source_unlock(ap->entry);
6bbd11
 		master_mutex_unlock();
6bbd11
 		pthread_setcancelstate(state, NULL);
6bbd11
-		return 1;
6bbd11
+		return 0;
6bbd11
 	}
6bbd11
 
6bbd11
 	mt = malloc(sizeof(struct pending_args));
6bbd11
@@ -1423,7 +1423,7 @@ int handle_packet_missing_direct(struct
6bbd11
 		master_source_unlock(ap->entry);
6bbd11
 		master_mutex_unlock();
6bbd11
 		pthread_setcancelstate(state, NULL);
6bbd11
-		return 1;
6bbd11
+		return 0;
6bbd11
 	}
6bbd11
 	memset(mt, 0, sizeof(struct pending_args));
6bbd11