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

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