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

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