Blame SOURCES/autofs-5.1.7-fix-nonstrict-offset-mount-fail-handling.patch

29d2b9
autofs-5.1.7 - fix nonstrict offset mount fail handling
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
If a triggered offset mount fails automount is not handling nonstrict
29d2b9
mount failure correctly.
29d2b9
29d2b9
The nonstrict mount failure handling needs to convert an offset mount
29d2b9
failure to a success if the offset subtree below the failed mount is not
29d2b9
empty otherwise it must return the failure. The previous implementation
29d2b9
used -1 to indicate the subtree was empty and that was used to detect
29d2b9
when the mount should fail instead of converting the fail to a success.
29d2b9
29d2b9
Make the new implementation do the same.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG           |    1 +
29d2b9
 lib/mounts.c        |    2 +-
29d2b9
 modules/parse_sun.c |    2 +-
29d2b9
 3 files changed, 3 insertions(+), 2 deletions(-)
29d2b9
29d2b9
--- autofs-5.1.7.orig/CHANGELOG
29d2b9
+++ autofs-5.1.7/CHANGELOG
29d2b9
@@ -76,6 +76,7 @@
29d2b9
 - fix direct mount deadlock.
29d2b9
 - fix lookup_prune_one_cache() refactoring change.
29d2b9
 - add missing description of null map option.
29d2b9
+- fix nonstrict offset mount fail handling.
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
--- autofs-5.1.7.orig/lib/mounts.c
29d2b9
+++ autofs-5.1.7/lib/mounts.c
29d2b9
@@ -1616,7 +1616,7 @@ static int tree_mapent_traverse_subtree(
29d2b9
 {
29d2b9
 	struct traverse_subtree_context *ctxt = ptr;
29d2b9
 	struct mapent *oe = MAPENT(n);
29d2b9
-	int ret = 1;
29d2b9
+	int ret = -1;
29d2b9
 
29d2b9
 	if (n->left) {
29d2b9
 		ret = tree_mapent_traverse_subtree(n->left, work, ctxt);
29d2b9
--- autofs-5.1.7.orig/modules/parse_sun.c
29d2b9
+++ autofs-5.1.7/modules/parse_sun.c
29d2b9
@@ -1181,7 +1181,7 @@ static int mount_subtree(struct autofs_p
29d2b9
 		 * offsets to be mounted.
29d2b9
 		 */
29d2b9
 		rv = sun_mount(ap, name, name, namelen, loc, loclen, options, ctxt);
29d2b9
-		if (rv == 0) {
29d2b9
+		if (rv <= 0) {
29d2b9
 			ret = tree_mapent_mount_offsets(me, 1);
29d2b9
 			if (!ret) {
29d2b9
 				tree_mapent_cleanup_offsets(me);