]> git.pld-linux.org Git - packages/autofs.git/blob - autofs-5.0.4-manual-umount-recovery-fixes.patch
- updated to 5.0.5, nfy.
[packages/autofs.git] / autofs-5.0.4-manual-umount-recovery-fixes.patch
1 autofs-5.0.4 - mannual umount recovery fixes
2
3 From: Ian Kent <raven@themaw.net>
4
5 Check for the absence of a mount before doing the manual umount
6 checks and check ioctlfd is valid seperately. Take a write lock
7 on the map entry mutex to ensure any mount request is complete
8 before checking.
9 ---
10
11  CHANGELOG         |    1 +
12  daemon/direct.c   |    4 ++--
13  daemon/indirect.c |   37 +++++++++++++++++++++++--------------
14  3 files changed, 26 insertions(+), 16 deletions(-)
15
16
17 diff --git a/CHANGELOG b/CHANGELOG
18 index f0d0e58..05e0206 100644
19 --- a/CHANGELOG
20 +++ b/CHANGELOG
21 @@ -54,6 +54,7 @@
22  - fix notify mount message path.
23  - remount we created mount point fix.
24  - fix double free in sasl_bind().
25 +- mannual umount recovery fixes.
26  
27  4/11/2008 autofs-5.0.4
28  -----------------------
29 diff --git a/daemon/direct.c b/daemon/direct.c
30 index 74a9acc..7b02c7a 100644
31 --- a/daemon/direct.c
32 +++ b/daemon/direct.c
33 @@ -889,9 +889,9 @@ void *expire_proc_direct(void *arg)
34                         /* Check for manual umount */
35                         cache_writelock(me->mc);
36                         if (me->ioctlfd != -1 && 
37 -                           fstat(ioctlfd, &st) != -1 &&
38 +                           fstat(me->ioctlfd, &st) != -1 &&
39                             !count_mounts(ap->logopt, next->path, st.st_dev)) {
40 -                               ops->close(ap->logopt, ioctlfd);
41 +                               ops->close(ap->logopt, me->ioctlfd);
42                                 me->ioctlfd = -1;
43                                 cache_unlock(me->mc);
44                                 pthread_setcancelstate(cur_state, NULL);
45 diff --git a/daemon/indirect.c b/daemon/indirect.c
46 index 463b39c..8025ee4 100644
47 --- a/daemon/indirect.c
48 +++ b/daemon/indirect.c
49 @@ -437,7 +437,19 @@ void *expire_proc_indirect(void *arg)
50                                 struct mapent *me = NULL;
51                                 struct stat st;
52  
53 -                               master_source_readlock(ap->entry);
54 +                               /* It's got a mount, deal with in the outer loop */
55 +                               if (is_mounted(_PATH_MOUNTED, next->path, MNTS_REAL)) {
56 +                                       pthread_setcancelstate(cur_state, NULL);
57 +                                       continue;
58 +                               }
59 +
60 +                               /* Don't touch submounts */
61 +                               if (master_find_submount(ap, next->path)) {
62 +                                       pthread_setcancelstate(cur_state, NULL);
63 +                                       continue;
64 +                               }
65 +
66 +                               master_source_writelock(ap->entry);
67  
68                                 map = ap->entry->maps;
69                                 while (map) {
70 @@ -456,20 +468,17 @@ void *expire_proc_indirect(void *arg)
71                                         continue;
72                                 }
73  
74 +                               if (me->ioctlfd == -1) {
75 +                                       cache_unlock(mc);
76 +                                       master_source_unlock(ap->entry);
77 +                                       pthread_setcancelstate(cur_state, NULL);
78 +                                       continue;
79 +                               }
80 +
81                                 /* Check for manual umount */
82 -                               if (me->ioctlfd != -1 &&
83 -                                   (fstat(me->ioctlfd, &st) == -1 ||
84 -                                    !count_mounts(ap->logopt, me->key, st.st_dev))) {
85 -                                       if (is_mounted(_PROC_MOUNTS, me->key, MNTS_REAL)) {
86 -                                               error(ap->logopt,
87 -                                                     "error: possible mtab mismatch %s",
88 -                                                     me->key);
89 -                                               cache_unlock(mc);
90 -                                               master_source_unlock(ap->entry);
91 -                                               pthread_setcancelstate(cur_state, NULL);
92 -                                               continue;
93 -                                       }
94 -                                       close(me->ioctlfd);
95 +                               if (fstat(me->ioctlfd, &st) == -1 ||
96 +                                   !count_mounts(ap->logopt, me->key, st.st_dev)) {
97 +                                       ops->close(ap->logopt, me->ioctlfd);
98                                         me->ioctlfd = -1;
99                                 }
100  
This page took 0.081517 seconds and 3 git commands to generate.