diff options
Diffstat (limited to 'fs/notify/vfsmount_mark.c')
-rw-r--r-- | fs/notify/vfsmount_mark.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c index 778fe6cae3b0..b7b4b0e8554f 100644 --- a/fs/notify/vfsmount_mark.c +++ b/fs/notify/vfsmount_mark.c | |||
@@ -28,15 +28,17 @@ | |||
28 | 28 | ||
29 | #include <linux/fsnotify_backend.h> | 29 | #include <linux/fsnotify_backend.h> |
30 | #include "fsnotify.h" | 30 | #include "fsnotify.h" |
31 | #include "../mount.h" | ||
31 | 32 | ||
32 | void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) | 33 | void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) |
33 | { | 34 | { |
34 | struct fsnotify_mark *mark, *lmark; | 35 | struct fsnotify_mark *mark, *lmark; |
35 | struct hlist_node *pos, *n; | 36 | struct hlist_node *pos, *n; |
37 | struct mount *m = real_mount(mnt); | ||
36 | LIST_HEAD(free_list); | 38 | LIST_HEAD(free_list); |
37 | 39 | ||
38 | spin_lock(&mnt->mnt_root->d_lock); | 40 | spin_lock(&mnt->mnt_root->d_lock); |
39 | hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { | 41 | hlist_for_each_entry_safe(mark, pos, n, &m->mnt_fsnotify_marks, m.m_list) { |
40 | list_add(&mark->m.free_m_list, &free_list); | 42 | list_add(&mark->m.free_m_list, &free_list); |
41 | hlist_del_init_rcu(&mark->m.m_list); | 43 | hlist_del_init_rcu(&mark->m.m_list); |
42 | fsnotify_get_mark(mark); | 44 | fsnotify_get_mark(mark); |
@@ -59,15 +61,16 @@ void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group) | |||
59 | */ | 61 | */ |
60 | static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) | 62 | static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) |
61 | { | 63 | { |
64 | struct mount *m = real_mount(mnt); | ||
62 | struct fsnotify_mark *mark; | 65 | struct fsnotify_mark *mark; |
63 | struct hlist_node *pos; | 66 | struct hlist_node *pos; |
64 | __u32 new_mask = 0; | 67 | __u32 new_mask = 0; |
65 | 68 | ||
66 | assert_spin_locked(&mnt->mnt_root->d_lock); | 69 | assert_spin_locked(&mnt->mnt_root->d_lock); |
67 | 70 | ||
68 | hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) | 71 | hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list) |
69 | new_mask |= mark->mask; | 72 | new_mask |= mark->mask; |
70 | mnt->mnt_fsnotify_mask = new_mask; | 73 | m->mnt_fsnotify_mask = new_mask; |
71 | } | 74 | } |
72 | 75 | ||
73 | /* | 76 | /* |
@@ -101,12 +104,13 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark) | |||
101 | static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group, | 104 | static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group, |
102 | struct vfsmount *mnt) | 105 | struct vfsmount *mnt) |
103 | { | 106 | { |
107 | struct mount *m = real_mount(mnt); | ||
104 | struct fsnotify_mark *mark; | 108 | struct fsnotify_mark *mark; |
105 | struct hlist_node *pos; | 109 | struct hlist_node *pos; |
106 | 110 | ||
107 | assert_spin_locked(&mnt->mnt_root->d_lock); | 111 | assert_spin_locked(&mnt->mnt_root->d_lock); |
108 | 112 | ||
109 | hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) { | 113 | hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list) { |
110 | if (mark->group == group) { | 114 | if (mark->group == group) { |
111 | fsnotify_get_mark(mark); | 115 | fsnotify_get_mark(mark); |
112 | return mark; | 116 | return mark; |
@@ -140,6 +144,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
140 | struct fsnotify_group *group, struct vfsmount *mnt, | 144 | struct fsnotify_group *group, struct vfsmount *mnt, |
141 | int allow_dups) | 145 | int allow_dups) |
142 | { | 146 | { |
147 | struct mount *m = real_mount(mnt); | ||
143 | struct fsnotify_mark *lmark; | 148 | struct fsnotify_mark *lmark; |
144 | struct hlist_node *node, *last = NULL; | 149 | struct hlist_node *node, *last = NULL; |
145 | int ret = 0; | 150 | int ret = 0; |
@@ -154,13 +159,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
154 | mark->m.mnt = mnt; | 159 | mark->m.mnt = mnt; |
155 | 160 | ||
156 | /* is mark the first mark? */ | 161 | /* is mark the first mark? */ |
157 | if (hlist_empty(&mnt->mnt_fsnotify_marks)) { | 162 | if (hlist_empty(&m->mnt_fsnotify_marks)) { |
158 | hlist_add_head_rcu(&mark->m.m_list, &mnt->mnt_fsnotify_marks); | 163 | hlist_add_head_rcu(&mark->m.m_list, &m->mnt_fsnotify_marks); |
159 | goto out; | 164 | goto out; |
160 | } | 165 | } |
161 | 166 | ||
162 | /* should mark be in the middle of the current list? */ | 167 | /* should mark be in the middle of the current list? */ |
163 | hlist_for_each_entry(lmark, node, &mnt->mnt_fsnotify_marks, m.m_list) { | 168 | hlist_for_each_entry(lmark, node, &m->mnt_fsnotify_marks, m.m_list) { |
164 | last = node; | 169 | last = node; |
165 | 170 | ||
166 | if ((lmark->group == group) && !allow_dups) { | 171 | if ((lmark->group == group) && !allow_dups) { |