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

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