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

f3080c
autofs-5.1.8 - fix root offset error handling
f3080c
f3080c
From: Ian Kent <raven@themaw.net>
f3080c
f3080c
If mounting the root or offsets of a multi-mount root fails any mounts
f3080c
done so far need to be umounted and the multi-mount offset tree deleted
f3080c
so it can be created cleanly and possibly mounted the next time it's
f3080c
triggered.
f3080c
f3080c
Also, if a subtree that is not the multi-mount root fails the expire
f3080c
alarm needs to be re-instated so other subtrees (at least the root)
f3080c
will continue to expire.
f3080c
f3080c
Signed-off-by: Ian Kent <raven@themaw.net>
f3080c
---
f3080c
 CHANGELOG           |    1 +
f3080c
 daemon/direct.c     |   11 ++++++++++-
f3080c
 modules/parse_sun.c |    6 ++++++
f3080c
 3 files changed, 17 insertions(+), 1 deletion(-)
f3080c
f3080c
--- autofs-5.1.4.orig/CHANGELOG
f3080c
+++ autofs-5.1.4/CHANGELOG
f3080c
@@ -83,6 +83,7 @@
f3080c
 - improve descriptor open error reporting.
f3080c
 - fix double quoting in auto.smb.
f3080c
 - fix double quoting of ampersand in auto.smb as well.
f3080c
+- fix root offset error handling.
f3080c
 
f3080c
 xx/xx/2018 autofs-5.1.5
f3080c
 - fix flag file permission.
f3080c
--- autofs-5.1.4.orig/daemon/direct.c
f3080c
+++ autofs-5.1.4/daemon/direct.c
f3080c
@@ -1163,6 +1163,7 @@ static void *do_mount_direct(void *arg)
f3080c
 	struct ioctl_ops *ops = get_ioctl_ops();
f3080c
 	struct pending_args *args, mt;
f3080c
 	struct autofs_point *ap;
f3080c
+	struct mapent *me;
f3080c
 	struct stat st;
f3080c
 	int status, state;
f3080c
 
f3080c
@@ -1226,7 +1227,6 @@ static void *do_mount_direct(void *arg)
f3080c
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
f3080c
 	if (status) {
f3080c
 		struct mnt_list *sbmnt;
f3080c
-		struct mapent *me;
f3080c
 		struct statfs fs;
f3080c
 		unsigned int close_fd = 0;
f3080c
 		unsigned int flags = MNTS_DIRECT|MNTS_MOUNTED;
f3080c
@@ -1267,6 +1267,15 @@ static void *do_mount_direct(void *arg)
f3080c
 			       mt.ioctlfd, mt.wait_queue_token, -ENOENT);
f3080c
 		ops->close(ap->logopt, mt.ioctlfd);
f3080c
 		info(ap->logopt, "failed to mount %s", mt.name);
f3080c
+
f3080c
+		/* If this is a multi-mount subtree mount failure
f3080c
+		 * ensure the tree continues to expire.
f3080c
+		 */
f3080c
+		cache_readlock(mt.mc);
f3080c
+		me = cache_lookup_distinct(mt.mc, mt.name);
f3080c
+		if (me && IS_MM(me) && !IS_MM_ROOT(me))
f3080c
+			conditional_alarm_add(ap, ap->exp_runfreq);
f3080c
+		cache_unlock(mt.mc);
f3080c
 	}
f3080c
 	pthread_setcancelstate(state, NULL);
f3080c
 
f3080c
--- autofs-5.1.4.orig/modules/parse_sun.c
f3080c
+++ autofs-5.1.4/modules/parse_sun.c
f3080c
@@ -1125,6 +1125,9 @@ static int mount_subtree(struct autofs_p
f3080c
 		if (!len) {
f3080c
 			warn(ap->logopt, "path loo long");
f3080c
 			cache_unlock(mc);
f3080c
+			cache_writelock(mc);
f3080c
+			tree_mapent_delete_offsets(mc, name);
f3080c
+			cache_unlock(mc);
f3080c
 			return 1;
f3080c
 		}
f3080c
 		key[len] = '/';
f3080c
@@ -1169,6 +1172,9 @@ static int mount_subtree(struct autofs_p
f3080c
 				cache_unlock(mc);
f3080c
 				error(ap->logopt, MODPREFIX
f3080c
 					 "failed to mount offset triggers");
f3080c
+				cache_writelock(mc);
f3080c
+				tree_mapent_delete_offsets(mc, name);
f3080c
+				cache_unlock(mc);
f3080c
 				return 1;
f3080c
 			}
f3080c
 		}