~ubuntu-branches/ubuntu/raring/autofs5/raring

« back to all changes in this revision

Viewing changes to debian/patches/01UPSTREAM_autofs-5.0.4-expire-specific-submount-only.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2009-03-09 01:16:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090309011648-gjynlid883f0s2c4
Tags: 5.0.4-1
* New upstream version (5.0.4 plus patchset as of 2009/03/09).
  * Closes: #518728.
  * Remove dpatch 14, applied upstream.
* New dpatch 14 to avoid using the relatively young SOCK_CLOEXEC
  feature.
* Only invoke 'make clean' on clean target so ./configure isn't
  purged.
* Fix a typo in the postinst regarding the ucf conffile handling.
* Add 'set -e' to package maintenance scripts.
* Drop unnecessary /var/run/autofs from package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 01UPSTREAM_autofs-5.0.4-expire-specific-submount-only.dpatch
 
3
##
 
4
## DP: Upstream patch.
 
5
 
 
6
@DPATCH@
 
7
autofs-5.0.4 - expire specific submount only
 
8
 
 
9
From: Ian Kent <raven@themaw.net>
 
10
 
 
11
The submount shutdown at expire assumes that certain locks are not
 
12
held but when notifying submounts containing nested submounts not
 
13
all locks were being released. This leads to occassional deadlock
 
14
when child submounts attempt to shutdown.
 
15
---
 
16
 
 
17
 CHANGELOG    |    1 +
 
18
 lib/master.c |   33 ++++++++-------------------------
 
19
 2 files changed, 9 insertions(+), 25 deletions(-)
 
20
 
 
21
 
 
22
diff --git a/CHANGELOG b/CHANGELOG
 
23
index 4e8209e..88ca579 100644
 
24
--- a/CHANGELOG
 
25
+++ b/CHANGELOG
 
26
@@ -1,6 +1,7 @@
 
27
 ??/??/2009 autofs-5.0.5
 
28
 -----------------------
 
29
 - fix dumb libxml2 check
 
30
+- fix nested submount expire deadlock.
 
31
 
 
32
 4/11/2008 autofs-5.0.4
 
33
 -----------------------
 
34
diff --git a/lib/master.c b/lib/master.c
 
35
index a243e6a..e1cc062 100644
 
36
--- a/lib/master.c
 
37
+++ b/lib/master.c
 
38
@@ -834,7 +834,6 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
 
39
 {
 
40
        struct list_head *head, *p;
 
41
        struct autofs_point *this = NULL;
 
42
-       size_t plen = strlen(path);
 
43
        int ret = 1;
 
44
 
 
45
        mounts_mutex_lock(ap);
 
46
@@ -842,37 +841,19 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
 
47
        head = &ap->submounts;
 
48
        p = head->prev;
 
49
        while (p != head) {
 
50
-               size_t len;
 
51
-
 
52
                this = list_entry(p, struct autofs_point, mounts);
 
53
                p = p->prev;
 
54
 
 
55
                if (!master_submount_list_empty(this)) {
 
56
-                       if (!master_notify_submount(this, path, state)) {
 
57
-                               ret = 0;
 
58
-                               break;
 
59
-                       }
 
60
+                       mounts_mutex_unlock(ap);
 
61
+                       return master_notify_submount(this, path, state);
 
62
                }
 
63
 
 
64
-               len = strlen(this->path);
 
65
-
 
66
-               /* Initial path not the same */
 
67
-               if (strncmp(this->path, path, len))
 
68
+               /* path not the same */
 
69
+               if (strcmp(this->path, path))
 
70
                        continue;
 
71
 
 
72
-               /*
 
73
-                * Part of submount tree?
 
74
-                * We must wait till we get to submount itself.
 
75
-                * If it is tell caller by returning true.
 
76
-                */
 
77
-               if (plen > len) {
 
78
-                       /* Not part of this directory tree */
 
79
-                       if (path[len] != '/')
 
80
-                               continue;
 
81
-                       break;
 
82
-               }
 
83
-
 
84
-               /* Now we have a submount to expire */
 
85
+               /* Now we have found the submount we want to expire */
 
86
 
 
87
                st_mutex_lock();
 
88
 
 
89
@@ -901,8 +882,10 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
 
90
                        struct timespec t = { 0, 300000000 };
 
91
                        struct timespec r;
 
92
 
 
93
-                       if (this->state != ST_SHUTDOWN)
 
94
+                       if (this->state != ST_SHUTDOWN) {
 
95
+                               ret = 0;
 
96
                                break;
 
97
+                       }
 
98
 
 
99
                        st_mutex_unlock();
 
100
                        mounts_mutex_unlock(ap);