Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 73

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.1 - fix not bind mounting local filesystem

From: Ian Kent <ikent@redhat.com>

When the --random-multimount-selection (-r) option is used automount(8)
won't bind mount a local filesystem. If the filesystem that has been
requested is local it should always be used.
---

 CHANGELOG            |    1 +
 modules/replicated.c |   47 +++++++++++++++++++++--------------------------
 2 files changed, 22 insertions(+), 26 deletions(-)


--- autofs-5.0.1.orig/CHANGELOG
+++ autofs-5.0.1/CHANGELOG
@@ -54,6 +54,7 @@
 - set close-on-exec flag on open sockets.
 - fix nonstrict multi-mount handling.
 - add nobind option.
+- fix not bind mounting local filesystem.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
--- autofs-5.0.1.orig/modules/replicated.c
+++ autofs-5.0.1/modules/replicated.c
@@ -999,20 +999,18 @@ static int add_host_addrs(struct host **
 		 * We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
 		 * to remove hosts that may be down.
 		 */
-		if (options & MOUNT_FLAG_RANDOM_SELECT)
+		prx = get_proximity(thost, sizeof(saddr.sin_addr));
+		/*
+		 * If we want the weight to be the determining factor
+		 * when selecting a host, or we are using random selection,
+		 * then all hosts must have the same proximity. However,
+		 * if this is the local machine it should always be used
+		 * since it is certainly available.
+		 */
+		if (prx != PROXIMITY_LOCAL &&
+		   (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
+			       MOUNT_FLAG_RANDOM_SELECT)))
 			prx = PROXIMITY_SUBNET;
-		else {
-			prx = get_proximity(thost, sizeof(saddr.sin_addr));
-			/*
-			 * If we want the weight to be the determining factor
-			 * when selecting a host then all hosts must have the
-			 * same proximity. However, if this is the local machine
-			 * it should always be used since it is certainly available.
-			 */
-			if (prx != PROXIMITY_LOCAL &&
-			   (options & MOUNT_FLAG_USE_WEIGHT_ONLY))
-				prx = PROXIMITY_SUBNET;
-		}
 
 		if (prx == PROXIMITY_ERROR)
 			return 0;
@@ -1053,20 +1051,17 @@ static int add_host_addrs(struct host **
 		 * We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
 		 * to remove hosts that may be down.
 		 */
-		if (options & MOUNT_FLAG_RANDOM_SELECT)
+		prx = get_proximity(*haddr, phe->h_length);
+		/*
+		 * If we want the weight to be the determining factor
+		 * when selecting a host then all hosts must have the
+		 * same proximity. However, if this is the local machine
+		 * it should always be used since it is certainly available.
+		 */
+		if (prx != PROXIMITY_LOCAL &&
+	   	   (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
+			       MOUNT_FLAG_RANDOM_SELECT)))
 			prx = PROXIMITY_SUBNET;
-		else {
-			prx = get_proximity(*haddr, phe->h_length);
-			/*
-			 * If we want the weight to be the determining factor
-			 * when selecting a host then all hosts must have the
-			 * same proximity. However, if this is the local machine
-			 * it should always be used since it is certainly available.
-			 */
-			if (prx != PROXIMITY_LOCAL &&
-			   (options & MOUNT_FLAG_USE_WEIGHT_ONLY))
-				prx = PROXIMITY_SUBNET;
-		}
 
 		if (prx == PROXIMITY_ERROR)
 			return 0;