Blame SOURCES/autofs-5.1.6-fix-browse-dir-not-re-created-on-symlink-expire.patch

9a499a
autofs-5.1.6 - fix browse dir not re-created on symlink expire
9a499a
9a499a
From: Ian Kent <raven@themaw.net>
9a499a
9a499a
If symlinks are being used for mounts and the autofs mount has browse mode
9a499a
enabled when a symlink is removed at expire the browse mode directory needs
9a499a
to be re-created.
9a499a
9a499a
Signed-off-by: Ian Kent <raven@themaw.net>
9a499a
---
9a499a
 CHANGELOG          |    1 +
9a499a
 daemon/automount.c |   19 +++++++++++++++++++
9a499a
 2 files changed, 20 insertions(+)
9a499a
9a499a
--- autofs-5.1.4.orig/CHANGELOG
9a499a
+++ autofs-5.1.4/CHANGELOG
9a499a
@@ -115,6 +115,7 @@ xx/xx/2018 autofs-5.1.5
9a499a
 - remove unused function dump_master().
9a499a
 - fix additional typing errors.
9a499a
 - make bind mounts propagation slave by default.
9a499a
+- fix browse dir not re-created on symlink expire.
9a499a
 
9a499a
 19/12/2017 autofs-5.1.4
9a499a
 - fix spec file url.
9a499a
--- autofs-5.1.4.orig/daemon/automount.c
9a499a
+++ autofs-5.1.4/daemon/automount.c
9a499a
@@ -651,6 +651,25 @@ int umount_multi(struct autofs_point *ap
9a499a
 			      "failed to remove symlink %s", path);
9a499a
 			return 1;
9a499a
 		}
9a499a
+		/* Check if the autofs mount has browse mode enabled.
9a499a
+		 * If so re-create the directory entry.
9a499a
+		 */
9a499a
+		if (ap->flags | MOUNT_FLAG_GHOST) {
9a499a
+			int ret;
9a499a
+
9a499a
+			/* If the browse directory create fails log an
9a499a
+			 * error and continue anyway since the expire
9a499a
+			 * has succeeded.
9a499a
+			 */
9a499a
+			ret = mkdir_path(path, mp_mode);
9a499a
+			if (ret && errno != EEXIST) {
9a499a
+				char buf[MAX_ERR_BUF];
9a499a
+				char *estr;
9a499a
+				estr = strerror_r(errno, buf, MAX_ERR_BUF);
9a499a
+				warn(ap->logopt,
9a499a
+				     "mkdir_path %s failed: %s", path, estr);
9a499a
+			}
9a499a
+		}
9a499a
 		/* Check for an external mount and attempt umount if needed */
9a499a
 		mounts_mutex_lock(ap);
9a499a
 		entry = __master_find_amdmount(ap, path);