Blame SOURCES/autofs-5.1.8-fix-root-offset-error-handling.patch

4218b4
autofs-5.1.8 - fix root offset error handling
4218b4
4218b4
From: Ian Kent <raven@themaw.net>
4218b4
4218b4
If mounting the root or offsets of a multi-mount root fails any mounts
4218b4
done so far need to be umounted and the multi-mount offset tree deleted
4218b4
so it can be created cleanly and possibly mounted the next time it's
4218b4
triggered.
4218b4
4218b4
Also, if a subtree that is not the multi-mount root fails the expire
4218b4
alarm needs to be re-instated so other subtrees (at least the root)
4218b4
will continue to expire.
4218b4
4218b4
Signed-off-by: Ian Kent <raven@themaw.net>
4218b4
---
4218b4
 CHANGELOG           |    1 +
4218b4
 daemon/direct.c     |   10 +++++++++-
4218b4
 modules/parse_sun.c |    6 ++++++
4218b4
 3 files changed, 16 insertions(+), 1 deletion(-)
4218b4
4218b4
--- autofs-5.1.7.orig/CHANGELOG
4218b4
+++ autofs-5.1.7/CHANGELOG
4218b4
@@ -84,6 +84,7 @@
4218b4
 - fix fedfs build flags.
4218b4
 - fix set open file limit.
4218b4
 - improve descriptor open error reporting.
4218b4
+- fix root offset error handling.
4218b4
 
4218b4
 25/01/2021 autofs-5.1.7
4218b4
 - make bind mounts propagation slave by default.
4218b4
--- autofs-5.1.7.orig/daemon/direct.c
4218b4
+++ autofs-5.1.7/daemon/direct.c
4218b4
@@ -1163,6 +1163,7 @@ static void *do_mount_direct(void *arg)
4218b4
 	struct ioctl_ops *ops = get_ioctl_ops();
4218b4
 	struct pending_args *args, mt;
4218b4
 	struct autofs_point *ap;
4218b4
+	struct mapent *me;
4218b4
 	struct stat st;
4218b4
 	int status, state;
4218b4
 
4218b4
@@ -1226,7 +1227,6 @@ static void *do_mount_direct(void *arg)
4218b4
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
4218b4
 	if (status) {
4218b4
 		struct mnt_list *sbmnt;
4218b4
-		struct mapent *me;
4218b4
 		struct statfs fs;
4218b4
 		unsigned int close_fd = 0;
4218b4
 		unsigned int flags = MNTS_DIRECT|MNTS_MOUNTED;
4218b4
@@ -1267,6 +1267,14 @@ static void *do_mount_direct(void *arg)
4218b4
 			       mt.ioctlfd, mt.wait_queue_token, -ENOENT);
4218b4
 		ops->close(ap->logopt, mt.ioctlfd);
4218b4
 		info(ap->logopt, "failed to mount %s", mt.name);
4218b4
+
4218b4
+		/* If this is a multi-mount subtree mount failure
4218b4
+		 * ensure the tree continues to expire.
4218b4
+		 */
4218b4
+		me = cache_lookup_distinct(mt.mc, mt.name);
4218b4
+		if (me && IS_MM(me) && !IS_MM_ROOT(me))
4218b4
+			conditional_alarm_add(ap, ap->exp_runfreq);
4218b4
+		cache_unlock(mt.mc);
4218b4
 	}
4218b4
 	pthread_setcancelstate(state, NULL);
4218b4
 
4218b4
--- autofs-5.1.7.orig/modules/parse_sun.c
4218b4
+++ autofs-5.1.7/modules/parse_sun.c
4218b4
@@ -1142,6 +1142,9 @@ static int mount_subtree(struct autofs_p
4218b4
 		if (!len) {
4218b4
 			warn(ap->logopt, "path loo long");
4218b4
 			cache_unlock(mc);
4218b4
+			cache_writelock(mc);
4218b4
+			tree_mapent_delete_offsets(mc, name);
4218b4
+			cache_unlock(mc);
4218b4
 			return 1;
4218b4
 		}
4218b4
 		key[len] = '/';
4218b4
@@ -1186,6 +1189,9 @@ static int mount_subtree(struct autofs_p
4218b4
 				cache_unlock(mc);
4218b4
 				error(ap->logopt, MODPREFIX
4218b4
 					 "failed to mount offset triggers");
4218b4
+				cache_writelock(mc);
4218b4
+				tree_mapent_delete_offsets(mc, name);
4218b4
+				cache_unlock(mc);
4218b4
 				return 1;
4218b4
 			}
4218b4
 		}