diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
commit | 1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch) | |
tree | 0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch | |
download | meta-openembedded-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch')
-rw-r--r-- | meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch new file mode 100644 index 0000000000..e6549a7c8f --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.6-fix-recursive-mount-deadlock.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | autofs-5.0.6 - fix recursive mount deadlock | ||
2 | |||
3 | From: Ian Kent <raven@themaw.net> | ||
4 | |||
5 | Prior to the vfs-automount changes that went into 2.6.38 | ||
6 | and were finalized in 3.1 it was not possible to block | ||
7 | path walks into multi-mounts whose root was covered by | ||
8 | another mount. To deal with that a write lock was used | ||
9 | to ensure the mount tree construction was completed. This | ||
10 | restricts the types of recursively defined mount maps that | ||
11 | can be used and can lead to a deadlock during lookup. | ||
12 | |||
13 | Now that we can prevent processes walking into multi-mounts | ||
14 | that are under construction we no longer need to use a | ||
15 | write lock. | ||
16 | |||
17 | Also, in the patch below, a cache writelock is changed to | ||
18 | a read lock because a write lock isn't needed since the | ||
19 | map cache entry isn't being updated. | ||
20 | --- | ||
21 | |||
22 | CHANGELOG | 1 + | ||
23 | daemon/direct.c | 14 ++++++++++++-- | ||
24 | 2 files changed, 13 insertions(+), 2 deletions(-) | ||
25 | |||
26 | |||
27 | diff --git a/CHANGELOG b/CHANGELOG | ||
28 | index 936c9ab..9cdad6e 100644 | ||
29 | --- a/CHANGELOG | ||
30 | +++ b/CHANGELOG | ||
31 | @@ -12,6 +12,7 @@ | ||
32 | - configure.in: allow cross compilation. | ||
33 | - README: update mailing list subscription info. | ||
34 | - allow non root user to check status. | ||
35 | +- fix recursive mount deadlock. | ||
36 | |||
37 | 25/07/2012 autofs-5.0.7 | ||
38 | ======================= | ||
39 | diff --git a/daemon/direct.c b/daemon/direct.c | ||
40 | index 7e2f0d7..3e09c5d 100644 | ||
41 | --- a/daemon/direct.c | ||
42 | +++ b/daemon/direct.c | ||
43 | @@ -1285,6 +1285,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ | ||
44 | struct timespec wait; | ||
45 | struct timeval now; | ||
46 | int ioctlfd, len, state; | ||
47 | + unsigned int kver_major = get_kver_major(); | ||
48 | + unsigned int kver_minor = get_kver_minor(); | ||
49 | |||
50 | pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); | ||
51 | |||
52 | @@ -1297,8 +1299,16 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ | ||
53 | * cache entry we will not be able to find the mapent. So | ||
54 | * we must take the source writelock to ensure the parent | ||
55 | * has mount is complete before we look for the entry. | ||
56 | + * | ||
57 | + * Since the vfs-automount kernel changes we can now block | ||
58 | + * on covered mounts during mount tree construction so a | ||
59 | + * write lock is no longer needed. So we now can handle a | ||
60 | + * wider class of recursively define mount lookups. | ||
61 | */ | ||
62 | - master_source_writelock(ap->entry); | ||
63 | + if (kver_major > 5 || (kver_major == 5 && kver_minor > 1)) | ||
64 | + master_source_readlock(ap->entry); | ||
65 | + else | ||
66 | + master_source_writelock(ap->entry); | ||
67 | map = ap->entry->maps; | ||
68 | while (map) { | ||
69 | /* | ||
70 | @@ -1311,7 +1321,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ | ||
71 | } | ||
72 | |||
73 | mc = map->mc; | ||
74 | - cache_writelock(mc); | ||
75 | + cache_readlock(mc); | ||
76 | me = cache_lookup_ino(mc, pkt->dev, pkt->ino); | ||
77 | if (me) | ||
78 | break; | ||