]>
Commit | Line | Data |
---|---|---|
92208998 KK |
1 | --- linux-2.6.22/fs/dcache.c.orig 2007-07-09 01:32:17.000000000 +0200 |
2 | +++ linux-2.6.22/fs/dcache.c 2008-06-24 12:00:23.000000000 +0200 | |
3 | @@ -1407,9 +1407,6 @@ | |
4 | if (atomic_read(&dentry->d_count) == 1) { | |
5 | dentry_iput(dentry); | |
6 | fsnotify_nameremove(dentry, isdir); | |
7 | - | |
8 | - /* remove this and other inotify debug checks after 2.6.18 */ | |
9 | - dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; | |
10 | return; | |
11 | } | |
12 | ||
13 | --- linux-2.6.22/fs/inotify.c.orig 2007-07-09 01:32:17.000000000 +0200 | |
14 | +++ linux-2.6.22/fs/inotify.c 2008-06-24 12:17:40.000000000 +0200 | |
15 | @@ -168,20 +168,14 @@ | |
16 | struct dentry *child; | |
17 | ||
18 | list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { | |
19 | - if (!child->d_inode) { | |
20 | - WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | |
21 | + if (!child->d_inode) | |
22 | continue; | |
23 | - } | |
24 | + | |
25 | spin_lock(&child->d_lock); | |
26 | - if (watched) { | |
27 | - WARN_ON(child->d_flags & | |
28 | - DCACHE_INOTIFY_PARENT_WATCHED); | |
29 | + if (watched) | |
30 | child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | |
31 | - } else { | |
32 | - WARN_ON(!(child->d_flags & | |
33 | - DCACHE_INOTIFY_PARENT_WATCHED)); | |
34 | + else | |
35 | child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED; | |
36 | - } | |
37 | spin_unlock(&child->d_lock); | |
38 | } | |
39 | } | |
40 | @@ -253,7 +247,6 @@ | |
41 | if (!inode) | |
42 | return; | |
43 | ||
44 | - WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | |
45 | spin_lock(&entry->d_lock); | |
46 | parent = entry->d_parent; | |
47 | if (parent->d_inode && inotify_inode_watched(parent->d_inode)) | |
48 | @@ -627,6 +620,7 @@ | |
49 | struct inode *inode, u32 mask) | |
50 | { | |
51 | int ret = 0; | |
52 | + int newly_watched; | |
53 | ||
54 | /* don't allow invalid bits: we don't want flags set */ | |
55 | mask &= IN_ALL_EVENTS | IN_ONESHOT; | |
56 | @@ -653,12 +647,18 @@ | |
57 | */ | |
58 | watch->inode = igrab(inode); | |
59 | ||
60 | - if (!inotify_inode_watched(inode)) | |
61 | - set_dentry_child_flags(inode, 1); | |
62 | - | |
63 | /* Add the watch to the handle's and the inode's list */ | |
64 | + newly_watched = !inotify_inode_watched(inode); | |
65 | list_add(&watch->h_list, &ih->watches); | |
66 | list_add(&watch->i_list, &inode->inotify_watches); | |
67 | + /* | |
68 | + * Set child flags _after_ adding the watch, so there is no race | |
69 | + * windows where newly instantiated children could miss their parent's | |
70 | + * watched flag. | |
71 | + */ | |
72 | + if (newly_watched) | |
73 | + set_dentry_child_flags(inode, 1); | |
74 | + | |
75 | out: | |
76 | mutex_unlock(&ih->mutex); | |
77 | mutex_unlock(&inode->inotify_mutex); |