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

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