Blob Blame History Raw
autofs-5.0.9 - amd lookup try to use external mounts for real mounts

From: Ian Kent <ikent@redhat.com>

When using generic type mounts they may point to user mounted
external mounts which doesn't need to be mounted or umounted.

The current usage doesn't always use external mounts which isn't
quite right so, if option fs is defined use, an external.
---
 modules/parse_amd.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index 410f6ff..790f25e 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -970,7 +970,7 @@ static int do_generic_mount(struct autofs_point *ap, const char *name,
 	unsigned int umount = 0;
 	int ret = 0;
 
-	if (!entry->sublink) {
+	if (!entry->fs) {
 		ret = do_mount(ap, ap->path, name, strlen(name),
 			       target, entry->type, entry->opts);
 	} else {
@@ -986,7 +986,7 @@ static int do_generic_mount(struct autofs_point *ap, const char *name,
 				goto out;
 			umount = 1;
 		}
-		/* We might be using an external mount */
+		/* We have an external mount */
 		ext_mount_add(&entry->ext_mount, entry->fs, umount);
 		ret = do_link_mount(ap, name, entry, flags);
 	}
@@ -1237,6 +1237,11 @@ static unsigned int validate_generic_options(unsigned int logopt,
 			return 0;
 		}
 	}
+	if (entry->sublink && !entry->fs) {
+		error(logopt, MODPREFIX
+		      "%s: sublink option requires option fs");
+		return 0;
+	}
 	return 1;
 }