87 #include <linux/kernel.h>
89 #include <linux/module.h>
91 #include <linux/slab.h>
113 mark->free_mark(mark);
123 struct fsnotify_group *
group;
126 spin_lock(&mark->lock);
131 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) {
132 spin_unlock(&mark->lock);
136 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
138 spin_lock(&group->mark_lock);
140 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) {
141 inode = mark->i.inode;
143 }
else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT)
148 list_del_init(&mark->g_list);
150 spin_unlock(&group->mark_lock);
151 spin_unlock(&mark->lock);
153 spin_lock(&destroy_lock);
154 list_add(&mark->destroy_list, &destroy_list);
155 spin_unlock(&destroy_lock);
163 if (group->ops->freeing_mark)
164 group->ops->freeing_mark(mark, group);
178 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))
201 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE)
209 mark->ignored_mask =
mask;
219 struct vfsmount *mnt,
int allow_dups)
232 spin_lock(&mark->lock);
233 spin_lock(&group->mark_lock);
235 mark->flags |= FSNOTIFY_MARK_FLAG_ALIVE;
238 list_add(&mark->g_list, &group->marks_list);
254 spin_unlock(&group->mark_lock);
259 spin_unlock(&mark->lock);
266 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
267 list_del_init(&mark->g_list);
271 spin_unlock(&group->mark_lock);
272 spin_unlock(&mark->lock);
274 spin_lock(&destroy_lock);
275 list_add(&mark->destroy_list, &destroy_list);
276 spin_unlock(&destroy_lock);
288 struct fsnotify_mark *lmark, *
mark;
291 spin_lock(&group->mark_lock);
293 if (mark->flags & flags) {
294 list_add(&mark->free_g_list, &
free_list);
295 list_del_init(&mark->g_list);
299 spin_unlock(&group->mark_lock);
318 new->i.inode = old->i.inode;
319 new->m.mnt = old->m.mnt;
320 new->group = old->group;
321 new->mask = old->mask;
322 new->free_mark = old->free_mark;
329 void (*free_mark)(
struct fsnotify_mark *mark))
331 memset(mark, 0,
sizeof(*mark));
334 mark->free_mark = free_mark;
337 static int fsnotify_mark_destroy(
void *
ignored)
343 spin_lock(&destroy_lock);
345 list_replace_init(&destroy_list, &private_destroy_list);
346 spin_unlock(&destroy_lock);
351 list_del_init(&mark->destroy_list);
361 static int __init fsnotify_mark_init(
void)
368 panic(
"unable to start fsnotify mark destruction thread.");