[autofs] - fix systemd unit, offset directory management and server probe problems.
Ian Kent
iankent at fedoraproject.org
Mon Jul 16 02:23:51 UTC 2012
commit bdb1ad8d9f3d6af8c86214f6e661fae5fbe21d1b
Author: Ian Kent <ikent at redhat.com>
Date: Mon Jul 16 10:21:44 2012 +0800
- fix systemd unit, offset directory management and server probe problems.
...-5.0.6-fix-get_nfs_info-incorrectly-fails.patch | 35 ++++++++
autofs-5.0.6-fix-offset-dir-removal.patch | 88 ++++++++++++++++++++
autofs-5.0.6-fix-systemd-argument-passing.patch | 36 ++++++++
autofs.spec | 13 +++-
4 files changed, 171 insertions(+), 1 deletions(-)
---
diff --git a/autofs-5.0.6-fix-get_nfs_info-incorrectly-fails.patch b/autofs-5.0.6-fix-get_nfs_info-incorrectly-fails.patch
new file mode 100644
index 0000000..8617a15
--- /dev/null
+++ b/autofs-5.0.6-fix-get_nfs_info-incorrectly-fails.patch
@@ -0,0 +1,35 @@
+autofs-5.0.6 - fix get_nfs_info() can incorrectly fail
+
+From: Ian Kent <ikent at redhat.com>
+
+In function get_nfs_info(), if both TCP and UDP protocols are being
+checked, the TCP check passes but the UDP check fails, the function
+will incorrectly return a fail to the caller.
+---
+
+ CHANGELOG | 1 +
+ modules/replicated.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+
+--- autofs-5.0.6.orig/CHANGELOG
++++ autofs-5.0.6/CHANGELOG
+@@ -59,6 +59,7 @@
+ - fix devce ioctl alloc path check.
+ - add hup signal handling to hosts map.
+ - fix systemd argument passing.
++- fix get_nfs_info() can incorrectly fail.
+
+ 28/06/2011 autofs-5.0.6
+ -----------------------
+--- autofs-5.0.6.orig/modules/replicated.c
++++ autofs-5.0.6/modules/replicated.c
+@@ -769,7 +769,7 @@ static int get_vers_and_cost(unsigned lo
+ supported = get_nfs_info(logopt, host,
+ &pm_info, &rpc_info, "udp", vers, options);
+ if (IS_ERR(supported)) {
+- if (ERR(supported) == ETIMEDOUT)
++ if (!ret && ERR(supported) == ETIMEDOUT)
+ return ret;
+ } else if (supported) {
+ ret = 1;
diff --git a/autofs-5.0.6-fix-offset-dir-removal.patch b/autofs-5.0.6-fix-offset-dir-removal.patch
new file mode 100644
index 0000000..b9b6a4d
--- /dev/null
+++ b/autofs-5.0.6-fix-offset-dir-removal.patch
@@ -0,0 +1,88 @@
+autofs-5.0.6 - fix offset dir removal
+
+From: Ian Kent <ikent at redhat.com>
+
+When removing autofs multi-mount directories (which usually means the
+top level tree where no mount is present at the base) at expire we
+need to take care not to remove the top directory of the tree if the
+origin map is an indirect mount that has the browse option set.
+---
+
+ lib/mounts.c | 43 +++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 41 insertions(+), 2 deletions(-)
+
+
+--- autofs-5.0.6.orig/lib/mounts.c
++++ autofs-5.0.6/lib/mounts.c
+@@ -1687,6 +1687,41 @@ cont:
+ return mounted;
+ }
+
++static int rmdir_path_offset(struct autofs_point *ap, struct mapent *oe)
++{
++ char *dir, *path;
++ unsigned int split;
++ int ret;
++
++ if (ap->type == LKP_DIRECT)
++ return rmdir_path(ap, oe->key, oe->multi->dev);
++
++ dir = strdup(oe->key);
++
++ if (ap->flags & MOUNT_FLAG_GHOST)
++ split = strlen(ap->path) + strlen(oe->multi->key) + 1;
++ else
++ split = strlen(ap->path);
++
++ dir[split] = '\0';
++ path = &dir[split + 1];
++
++ if (chdir(dir) == -1) {
++ error(ap->logopt, "failed to chdir to %s", dir);
++ free(dir);
++ return -1;
++ }
++
++ ret = rmdir_path(ap, path, ap->dev);
++
++ free(dir);
++
++ if (chdir("/") == -1)
++ error(ap->logopt, "failed to chdir to /");
++
++ return ret;
++}
++
+ int umount_multi_triggers(struct autofs_point *ap, struct mapent *me, char *root, const char *base)
+ {
+ char path[PATH_MAX + 1];
+@@ -1748,11 +1783,13 @@ int umount_multi_triggers(struct autofs_
+ * ok so only try and remount the offset if the
+ * actual mount point still exists.
+ */
+- ret = rmdir_path(ap, oe->key, ap->dev);
++ ret = rmdir_path_offset(ap, oe);
+ if (ret == -1 && !stat(oe->key, &st)) {
+ ret = do_mount_autofs_offset(ap, oe, root, offset);
+ if (ret)
+ left++;
++ /* But we did origianlly create this */
++ oe->flags |= MOUNT_FLAG_DIR_CREATED;
+ }
+ }
+ }
+@@ -1914,11 +1951,13 @@ int clean_stale_multi_triggers(struct au
+ * ok so only try and remount the offset if the
+ * actual mount point still exists.
+ */
+- ret = rmdir_path(ap, oe->key, ap->dev);
++ ret = rmdir_path_offset(ap, oe);
+ if (ret == -1 && !stat(oe->key, &st)) {
+ ret = do_mount_autofs_offset(ap, oe, root, offset);
+ if (ret) {
+ left++;
++ /* But we did origianlly create this */
++ oe->flags |= MOUNT_FLAG_DIR_CREATED;
+ free(key);
+ continue;
+ }
diff --git a/autofs-5.0.6-fix-systemd-argument-passing.patch b/autofs-5.0.6-fix-systemd-argument-passing.patch
new file mode 100644
index 0000000..d5572e3
--- /dev/null
+++ b/autofs-5.0.6-fix-systemd-argument-passing.patch
@@ -0,0 +1,36 @@
+autofs-5.0.6 - fix systemd argument passing
+
+From: Ian Kent <ikent at redhat.com>
+
+The substition of the environment variable OPTIONS, from the autofs
+confuguration may contain multiple elements that need to be passed
+as such when systemd run the unit file. That requires that the braces
+be omitted the ExecStart entry of the unit file.
+---
+
+ CHANGELOG | 1 +
+ samples/autofs.service.in | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+
+--- autofs-5.0.6.orig/CHANGELOG
++++ autofs-5.0.6/CHANGELOG
+@@ -58,6 +58,7 @@
+ - fix remount of multi mount.
+ - fix devce ioctl alloc path check.
+ - add hup signal handling to hosts map.
++- fix systemd argument passing.
+
+ 28/06/2011 autofs-5.0.6
+ -----------------------
+--- autofs-5.0.6.orig/samples/autofs.service.in
++++ autofs-5.0.6/samples/autofs.service.in
+@@ -6,7 +6,7 @@ After=network.target ypbind.service
+ Type=forking
+ PIDFile=@@autofspiddir@@/autofs.pid
+ EnvironmentFile=-@@autofsconfdir@@/autofs
+-ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
++ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
+ ExecReload=/usr/bin/kill -HUP $MAINPID
+ TimeoutSec=180
+
diff --git a/autofs.spec b/autofs.spec
index 845476c..c129b88 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.6
-Release: 21%{?dist}
+Release: 22%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@@ -81,6 +81,9 @@ Patch65: autofs-5.0.6-remove-cache-update-from-parse_mount.patch
Patch66: autofs-5.0.6-add-function-to-delete-offset-cache-entry.patch
Patch67: autofs-5.0.6-allow-update-of-multi-mount-offset-entries.patch
Patch68: autofs-5.0.6-add-hup-signal-handling-to-hosts-map.patch
+Patch69: autofs-5.0.6-fix-systemd-argument-passing.patch
+Patch70: autofs-5.0.6-fix-get_nfs_info-incorrectly-fails.patch
+Patch71: autofs-5.0.6-fix-offset-dir-removal.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
@@ -205,6 +208,9 @@ echo %{version}-%{release} > .version
%patch66 -p1
%patch67 -p1
%patch68 -p1
+%patch69 -p1
+%patch70 -p1
+%patch71 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -307,6 +313,11 @@ fi
%dir /etc/auto.master.d
%changelog
+* Mon Jul 30 2012 Ian Kent <ikent at redhat.com> - 1:5.0.6-21
+- fix systemd argument passing.
+- fix get_nfs_info() can incorrectly fail.
+- fix offset directory removal.
+
* Tue Jul 30 2012 Ian Kent <ikent at redhat.com> - 1:5.0.6-21
- fix fix LDAP result leaks on error paths.
- report map not read when debug logging.
More information about the scm-commits
mailing list