- some more upstream bug fixes.

This commit is contained in:
Ian Kent 2012-10-18 15:21:07 +08:00
parent 8f63fceb77
commit a131fea513
4 changed files with 185 additions and 1 deletions

View File

@ -0,0 +1,78 @@
autofs-5.0.6 - fix recursive mount deadlock
From: Ian Kent <raven@themaw.net>
Prior to the vfs-automount changes that went into 2.6.38
and were finalized in 3.1 it was not possible to block
path walks into multi-mounts whose root was covered by
another mount. To deal with that a write lock was used
to ensure the mount tree construction was completed. This
restricts the types of recursively defined mount maps that
can be used and can lead to a deadlock during lookup.
Now that we can prevent processes walking into multi-mounts
that are under construction we no longer need to use a
write lock.
Also, in the patch below, a cache writelock is changed to
a read lock because a write lock isn't needed since the
map cache entry isn't being updated.
---
CHANGELOG | 1 +
daemon/direct.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 936c9ab..9cdad6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@
- configure.in: allow cross compilation.
- README: update mailing list subscription info.
- allow non root user to check status.
+- fix recursive mount deadlock.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/direct.c b/daemon/direct.c
index 7e2f0d7..3e09c5d 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1285,6 +1285,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
struct timespec wait;
struct timeval now;
int ioctlfd, len, state;
+ unsigned int kver_major = get_kver_major();
+ unsigned int kver_minor = get_kver_minor();
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
@@ -1297,8 +1299,16 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
* cache entry we will not be able to find the mapent. So
* we must take the source writelock to ensure the parent
* has mount is complete before we look for the entry.
+ *
+ * Since the vfs-automount kernel changes we can now block
+ * on covered mounts during mount tree construction so a
+ * write lock is no longer needed. So we now can handle a
+ * wider class of recursively define mount lookups.
*/
- master_source_writelock(ap->entry);
+ if (kver_major > 5 || (kver_major == 5 && kver_minor > 1))
+ master_source_readlock(ap->entry);
+ else
+ master_source_writelock(ap->entry);
map = ap->entry->maps;
while (map) {
/*
@@ -1311,7 +1321,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
}
mc = map->mc;
- cache_writelock(mc);
+ cache_readlock(mc);
me = cache_lookup_ino(mc, pkt->dev, pkt->ino);
if (me)
break;

View File

@ -0,0 +1,38 @@
autofs-5.0.6 - increase file map read buffer size
From: Ian Kent <raven@themaw.net>
The file map entry read buffer can be too small for larger
multi-mount map entries so increase it.
---
CHANGELOG | 1 +
include/automount.h | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 9cdad6e..3bdf8a4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,7 @@
- README: update mailing list subscription info.
- allow non root user to check status.
- fix recursive mount deadlock.
+- increase file map read buffer size.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/automount.h b/include/automount.h
index 561fcc2..37541f5 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -233,7 +233,7 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev);
#define AUTOFS_LOOKUP_VERSION 5
#define KEY_MAX_LEN NAME_MAX
-#define MAPENT_MAX_LEN 4095
+#define MAPENT_MAX_LEN 16384
#define PARSE_MAX_BUF KEY_MAX_LEN + MAPENT_MAX_LEN + 2
int lookup_nss_read_master(struct master *master, time_t age);

View File

@ -0,0 +1,57 @@
autofs-5.0.7 - Handle new location of systemd
From: Frederic Crozat <fcrozat@suse.com>
Some distributions are moving systemd unit files from /lib to
/usr/lib, so we need to test both directories.
edit: imk
It occurs to me I've forgotten to check for the 64 bit variants
of the directories, so add them as well.
end edit: imk
---
CHANGELOG | 1 +
aclocal.m4 | 2 +-
configure | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 3bdf8a4..8f6bb3a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@
- allow non root user to check status.
- fix recursive mount deadlock.
- increase file map read buffer size.
+- handle new location of systemd.
25/07/2012 autofs-5.0.7
=======================
diff --git a/aclocal.m4 b/aclocal.m4
index 1798c8b..47bca0c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -234,7 +234,7 @@ AC_DEFUN([AF_WITH_SYSTEMD],
[if test "$withval" = yes; then
if test -z "$systemddir"; then
AC_MSG_CHECKING([location of the systemd unit files directory])
- for systemd_d in /lib/systemd/system; do
+ for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do
if test -z "$systemddir"; then
if test -d "$systemd_d"; then
systemddir="$systemd_d"
diff --git a/configure b/configure
index ba3bba6..3722a46 100755
--- a/configure
+++ b/configure
@@ -2157,7 +2157,7 @@ if test "${with_systemd+set}" = set; then :
if test -z "$systemddir"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
$as_echo_n "checking location of the systemd unit files directory... " >&6; }
- for systemd_d in /lib/systemd/system; do
+ for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do
if test -z "$systemddir"; then
if test -d "$systemd_d"; then
systemddir="$systemd_d"

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.7
Release: 5%{?dist}
Release: 6%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -27,6 +27,9 @@ Patch11: autofs-5.0.7-configure-in-allow-cross-compilation.patch
Patch12: autofs-5.0.7-README-update-mailing-list-subscription-info.patch
Patch13: autofs-5.0.7-allow-non-root-user-to-check-status.patch
Patch14: autofs-5.0.7-configure-allow-cross-compilation-update.patch
Patch15: autofs-5.0.6-fix-recursive-mount-deadlock.patch
Patch16: autofs-5.0.6-increase-file-map-read-buffer-size.patch
Patch17: autofs-5.0.7-handle-new-location-of-systemd.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
@ -97,6 +100,9 @@ echo %{version}-%{release} > .version
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -188,6 +194,11 @@ fi
%dir /etc/auto.master.d
%changelog
* Thu Oct 18 2012 Ian Kent <ikent@redhat.com> - 1:5.0.7-6
- fix recursive mount deadlock.
- increase file map read buffer size.
- handle new location of systemd.
* Tue Oct 15 2012 Ian Kent <ikent@redhat.com> - 1:5.0.7-5
- configure: allow cross compilation update.
- fix date in changelog entry.