diff options
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/fsnotify.c | 5 | ||||
-rw-r--r-- | fs/notify/fsnotify.h | 4 | ||||
-rw-r--r-- | fs/notify/group.c | 39 |
3 files changed, 2 insertions, 46 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 53b31f46d698..9ba29ee747cf 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -227,11 +227,6 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | |||
227 | if (mask & FS_MODIFY) | 227 | if (mask & FS_MODIFY) |
228 | __fsnotify_flush_ignored_mask(to_tell, data, data_is); | 228 | __fsnotify_flush_ignored_mask(to_tell, data, data_is); |
229 | 229 | ||
230 | /* if none of the directed listeners or vfsmount listeners care */ | ||
231 | if (!(test_mask & fsnotify_inode_mask) && | ||
232 | !(test_mask & fsnotify_vfsmount_mask)) | ||
233 | return 0; | ||
234 | |||
235 | if (data_is == FSNOTIFY_EVENT_FILE) | 230 | if (data_is == FSNOTIFY_EVENT_FILE) |
236 | mnt = ((struct file *)data)->f_path.mnt; | 231 | mnt = ((struct file *)data)->f_path.mnt; |
237 | 232 | ||
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h index 7eed86f942ba..b41dbf5a125c 100644 --- a/fs/notify/fsnotify.h +++ b/fs/notify/fsnotify.h | |||
@@ -10,10 +10,6 @@ | |||
10 | extern struct list_head fsnotify_inode_groups; | 10 | extern struct list_head fsnotify_inode_groups; |
11 | /* all groups which receive vfsmount fsnotify events */ | 11 | /* all groups which receive vfsmount fsnotify events */ |
12 | extern struct list_head fsnotify_vfsmount_groups; | 12 | extern struct list_head fsnotify_vfsmount_groups; |
13 | /* all bitwise OR of all event types (FS_*) for all fsnotify_inode_groups */ | ||
14 | extern __u32 fsnotify_inode_mask; | ||
15 | /* all bitwise OR of all event types (FS_*) for all fsnotify_vfsmount_groups */ | ||
16 | extern __u32 fsnotify_vfsmount_mask; | ||
17 | 13 | ||
18 | /* destroy all events sitting in this groups notification queue */ | 14 | /* destroy all events sitting in this groups notification queue */ |
19 | extern void fsnotify_flush_notify(struct fsnotify_group *group); | 15 | extern void fsnotify_flush_notify(struct fsnotify_group *group); |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 48d3a6d6e47a..8da532dd6026 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -34,54 +34,21 @@ static DEFINE_MUTEX(fsnotify_grp_mutex); | |||
34 | LIST_HEAD(fsnotify_inode_groups); | 34 | LIST_HEAD(fsnotify_inode_groups); |
35 | /* all groups registered to receive mount point filesystem notifications */ | 35 | /* all groups registered to receive mount point filesystem notifications */ |
36 | LIST_HEAD(fsnotify_vfsmount_groups); | 36 | LIST_HEAD(fsnotify_vfsmount_groups); |
37 | /* bitwise OR of all events (FS_*) interesting to some group on this system */ | ||
38 | __u32 fsnotify_inode_mask; | ||
39 | /* bitwise OR of all events (FS_*) interesting to some group on this system */ | ||
40 | __u32 fsnotify_vfsmount_mask; | ||
41 | |||
42 | /* | ||
43 | * When a new group registers or changes it's set of interesting events | ||
44 | * this function updates the fsnotify_mask to contain all interesting events | ||
45 | */ | ||
46 | void fsnotify_recalc_global_mask(void) | ||
47 | { | ||
48 | struct fsnotify_group *group; | ||
49 | __u32 inode_mask = 0; | ||
50 | __u32 vfsmount_mask = 0; | ||
51 | |||
52 | mutex_lock(&fsnotify_grp_mutex); | ||
53 | list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list) | ||
54 | inode_mask |= group->mask; | ||
55 | list_for_each_entry_rcu(group, &fsnotify_vfsmount_groups, vfsmount_group_list) | ||
56 | vfsmount_mask |= group->mask; | ||
57 | |||
58 | fsnotify_inode_mask = inode_mask; | ||
59 | fsnotify_vfsmount_mask = vfsmount_mask; | ||
60 | |||
61 | mutex_unlock(&fsnotify_grp_mutex); | ||
62 | } | ||
63 | 37 | ||
64 | /* | 38 | /* |
65 | * Update the group->mask by running all of the marks associated with this | 39 | * Update the group->mask by running all of the marks associated with this |
66 | * group and finding the bitwise | of all of the mark->mask. If we change | 40 | * group and finding the bitwise | of all of the mark->mask. |
67 | * the group->mask we need to update the global mask of events interesting | ||
68 | * to the system. | ||
69 | */ | 41 | */ |
70 | void fsnotify_recalc_group_mask(struct fsnotify_group *group) | 42 | void fsnotify_recalc_group_mask(struct fsnotify_group *group) |
71 | { | 43 | { |
72 | __u32 mask = 0; | 44 | __u32 mask = 0; |
73 | __u32 old_mask = group->mask; | ||
74 | struct fsnotify_mark *mark; | 45 | struct fsnotify_mark *mark; |
75 | 46 | ||
76 | spin_lock(&group->mark_lock); | 47 | spin_lock(&group->mark_lock); |
77 | list_for_each_entry(mark, &group->marks_list, g_list) | 48 | list_for_each_entry(mark, &group->marks_list, g_list) |
78 | mask |= mark->mask; | 49 | mask |= mark->mask; |
79 | spin_unlock(&group->mark_lock); | ||
80 | |||
81 | group->mask = mask; | 50 | group->mask = mask; |
82 | 51 | spin_unlock(&group->mark_lock); | |
83 | if (old_mask != mask) | ||
84 | fsnotify_recalc_global_mask(); | ||
85 | } | 52 | } |
86 | 53 | ||
87 | void fsnotify_add_vfsmount_group(struct fsnotify_group *group) | 54 | void fsnotify_add_vfsmount_group(struct fsnotify_group *group) |
@@ -217,8 +184,6 @@ void fsnotify_put_group(struct fsnotify_group *group) | |||
217 | 184 | ||
218 | mutex_unlock(&fsnotify_grp_mutex); | 185 | mutex_unlock(&fsnotify_grp_mutex); |
219 | 186 | ||
220 | /* and now it is really dead. _Nothing_ could be seeing it */ | ||
221 | fsnotify_recalc_global_mask(); | ||
222 | fsnotify_destroy_group(group); | 187 | fsnotify_destroy_group(group); |
223 | } | 188 | } |
224 | 189 | ||