21 #include <linux/kernel.h>
22 #include <linux/module.h>
31 #include "../internal.h"
36 static void fsnotify_recalc_inode_mask_locked(
struct inode *
inode)
38 struct fsnotify_mark *
mark;
45 new_mask |= mark->
mask;
46 inode->i_fsnotify_mask = new_mask;
55 spin_lock(&inode->i_lock);
56 fsnotify_recalc_inode_mask_locked(inode);
57 spin_unlock(&inode->i_lock);
64 struct inode *inode = mark->i.inode;
71 hlist_del_init_rcu(&mark->i.i_list);
79 fsnotify_recalc_inode_mask_locked(inode);
81 spin_unlock(&inode->
i_lock);
89 struct fsnotify_mark *
mark, *lmark;
95 list_add(&mark->i.free_i_list, &
free_list);
96 hlist_del_init_rcu(&mark->i.i_list);
99 spin_unlock(&inode->
i_lock);
122 struct fsnotify_mark *
mark;
128 if (mark->group == group) {
143 struct fsnotify_mark *
mark;
145 spin_lock(&inode->
i_lock);
147 spin_unlock(&inode->
i_lock);
165 !(mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED)) {
166 mark->flags |= FSNOTIFY_MARK_FLAG_OBJECT_PINNED;
167 inode =
igrab(mark->i.inode);
185 struct fsnotify_group *
group,
struct inode *inode,
188 struct fsnotify_mark *lmark;
192 mark->flags |= FSNOTIFY_MARK_FLAG_INODE;
197 spin_lock(&inode->
i_lock);
199 mark->i.inode =
inode;
202 if (hlist_empty(&inode->i_fsnotify_marks)) {
203 hlist_add_head_rcu(&mark->i.i_list, &inode->i_fsnotify_marks);
211 if ((lmark->group == group) && !allow_dups) {
216 if (mark->group->priority < lmark->group->priority)
219 if ((mark->group->priority == lmark->group->priority) &&
220 (mark->group < lmark->group))
223 hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list);
229 hlist_add_after_rcu(last, &mark->i.i_list);
231 fsnotify_recalc_inode_mask_locked(inode);
232 spin_unlock(&inode->
i_lock);
246 struct inode *
inode, *next_i, *need_iput =
NULL;
250 struct inode *need_iput_tmp;
257 spin_lock(&inode->
i_lock);
259 spin_unlock(&inode->
i_lock);
270 spin_unlock(&inode->
i_lock);
274 need_iput_tmp = need_iput;
278 if (inode != need_iput_tmp)
281 need_iput_tmp =
NULL;
282 spin_unlock(&inode->
i_lock);
287 spin_lock(&next_i->
i_lock);
292 spin_unlock(&next_i->
i_lock);
306 fsnotify(inode, FS_UNMOUNT, inode, FSNOTIFY_EVENT_INODE,
NULL, 0);
308 fsnotify_inode_delete(inode);