From c267c68a0b2853000e6c1f316a0a16a41cf91ecd Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Dec 03 2008 05:15:25 +0000 Subject: - fix nested submount expire deadlock. --- diff --git a/autofs-5.0.4-expire-specific-submount-only.patch b/autofs-5.0.4-expire-specific-submount-only.patch new file mode 100644 index 0000000..0a6a804 --- /dev/null +++ b/autofs-5.0.4-expire-specific-submount-only.patch @@ -0,0 +1,94 @@ +autofs-5.0.4 - expire specific submount only + +From: Ian Kent + +The submount shutdown at expire assumes that certain locks are not +held but when notifying submounts containing nested submounts not +all locks were being released. This leads to occassional deadlock +when child submounts attempt to shutdown. +--- + + CHANGELOG | 1 + + lib/master.c | 33 ++++++++------------------------- + 2 files changed, 9 insertions(+), 25 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 4e8209e..88ca579 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,6 +1,7 @@ + ??/??/2009 autofs-5.0.5 + ----------------------- + - fix dumb libxml2 check ++- fix nested submount expire deadlock. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/lib/master.c b/lib/master.c +index a243e6a..e1cc062 100644 +--- a/lib/master.c ++++ b/lib/master.c +@@ -834,7 +834,6 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state + { + struct list_head *head, *p; + struct autofs_point *this = NULL; +- size_t plen = strlen(path); + int ret = 1; + + mounts_mutex_lock(ap); +@@ -842,37 +841,19 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state + head = &ap->submounts; + p = head->prev; + while (p != head) { +- size_t len; +- + this = list_entry(p, struct autofs_point, mounts); + p = p->prev; + + if (!master_submount_list_empty(this)) { +- if (!master_notify_submount(this, path, state)) { +- ret = 0; +- break; +- } ++ mounts_mutex_unlock(ap); ++ return master_notify_submount(this, path, state); + } + +- len = strlen(this->path); +- +- /* Initial path not the same */ +- if (strncmp(this->path, path, len)) ++ /* path not the same */ ++ if (strcmp(this->path, path)) + continue; + +- /* +- * Part of submount tree? +- * We must wait till we get to submount itself. +- * If it is tell caller by returning true. +- */ +- if (plen > len) { +- /* Not part of this directory tree */ +- if (path[len] != '/') +- continue; +- break; +- } +- +- /* Now we have a submount to expire */ ++ /* Now we have found the submount we want to expire */ + + st_mutex_lock(); + +@@ -901,8 +882,10 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state + struct timespec t = { 0, 300000000 }; + struct timespec r; + +- if (this->state != ST_SHUTDOWN) ++ if (this->state != ST_SHUTDOWN) { ++ ret = 0; + break; ++ } + + st_mutex_unlock(); + mounts_mutex_unlock(ap); diff --git a/autofs.spec b/autofs.spec index dce103e..8d6b612 100644 --- a/autofs.spec +++ b/autofs.spec @@ -4,13 +4,14 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.0.4 -Release: 3 +Release: 4 Epoch: 1 License: GPLv2+ Group: System Environment/Daemons URL: http://wiki.autofs.net/ Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.bz2 Patch1: autofs-5.0.4-fix-dumb-libxml2-check.patch +Patch2: autofs-5.0.4-expire-specific-submount-only.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs Requires: kernel >= 2.6.17 @@ -53,6 +54,7 @@ inkludera nÀtfilsystem, CD-ROM, floppydiskar, och sÄ vidare. %setup -q echo %{version}-%{release} > .version %patch1 -p1 +%patch2 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -105,6 +107,9 @@ fi %{_libdir}/autofs/ %changelog +* Wed Dec 3 2008 Ian Kent - 5.0.4-4 +- fix nested submount expire deadlock. + * Wed Nov 19 2008 Ian Kent - 5.0.4-3 - fix libxml2 version check for deciding whether to use workaround.