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

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