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

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