vfs: move fsnotify junk to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <asm/ioctls.h>
|
||||
|
||||
#include "../../mount.h"
|
||||
|
||||
#define FANOTIFY_DEFAULT_MAX_EVENTS 16384
|
||||
#define FANOTIFY_DEFAULT_MAX_MARKS 8192
|
||||
#define FANOTIFY_DEFAULT_MAX_LISTENERS 128
|
||||
@@ -546,7 +548,7 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group,
|
||||
|
||||
removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags);
|
||||
fsnotify_put_mark(fsn_mark);
|
||||
if (removed & mnt->mnt_fsnotify_mask)
|
||||
if (removed & real_mount(mnt)->mnt_fsnotify_mask)
|
||||
fsnotify_recalc_vfsmount_mask(mnt);
|
||||
|
||||
return 0;
|
||||
@@ -623,7 +625,7 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
|
||||
}
|
||||
added = fanotify_mark_add_to_mask(fsn_mark, mask, flags);
|
||||
|
||||
if (added & ~mnt->mnt_fsnotify_mask)
|
||||
if (added & ~real_mount(mnt)->mnt_fsnotify_mask)
|
||||
fsnotify_recalc_vfsmount_mask(mnt);
|
||||
err:
|
||||
fsnotify_put_mark(fsn_mark);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <linux/fsnotify_backend.h>
|
||||
#include "fsnotify.h"
|
||||
#include "../mount.h"
|
||||
|
||||
/*
|
||||
* Clear all of the marks on an inode when it is being evicted from core
|
||||
@@ -205,13 +206,13 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
|
||||
struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL;
|
||||
struct fsnotify_group *inode_group, *vfsmount_group;
|
||||
struct fsnotify_event *event = NULL;
|
||||
struct vfsmount *mnt;
|
||||
struct mount *mnt;
|
||||
int idx, ret = 0;
|
||||
/* global tests shouldn't care about events on child only the specific event */
|
||||
__u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
|
||||
|
||||
if (data_is == FSNOTIFY_EVENT_PATH)
|
||||
mnt = ((struct path *)data)->mnt;
|
||||
mnt = real_mount(((struct path *)data)->mnt);
|
||||
else
|
||||
mnt = NULL;
|
||||
|
||||
@@ -262,11 +263,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
|
||||
/* we didn't use the vfsmount_mark */
|
||||
vfsmount_group = NULL;
|
||||
} else if (vfsmount_group > inode_group) {
|
||||
ret = send_to_group(to_tell, mnt, NULL, vfsmount_mark, mask, data,
|
||||
ret = send_to_group(to_tell, &mnt->mnt, NULL, vfsmount_mark, mask, data,
|
||||
data_is, cookie, file_name, &event);
|
||||
inode_group = NULL;
|
||||
} else {
|
||||
ret = send_to_group(to_tell, mnt, inode_mark, vfsmount_mark,
|
||||
ret = send_to_group(to_tell, &mnt->mnt, inode_mark, vfsmount_mark,
|
||||
mask, data, data_is, cookie, file_name,
|
||||
&event);
|
||||
}
|
||||
|
||||
@@ -28,15 +28,17 @@
|
||||
|
||||
#include <linux/fsnotify_backend.h>
|
||||
#include "fsnotify.h"
|
||||
#include "../mount.h"
|
||||
|
||||
void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
|
||||
{
|
||||
struct fsnotify_mark *mark, *lmark;
|
||||
struct hlist_node *pos, *n;
|
||||
struct mount *m = real_mount(mnt);
|
||||
LIST_HEAD(free_list);
|
||||
|
||||
spin_lock(&mnt->mnt_root->d_lock);
|
||||
hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) {
|
||||
hlist_for_each_entry_safe(mark, pos, n, &m->mnt_fsnotify_marks, m.m_list) {
|
||||
list_add(&mark->m.free_m_list, &free_list);
|
||||
hlist_del_init_rcu(&mark->m.m_list);
|
||||
fsnotify_get_mark(mark);
|
||||
@@ -59,15 +61,16 @@ void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
|
||||
*/
|
||||
static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt)
|
||||
{
|
||||
struct mount *m = real_mount(mnt);
|
||||
struct fsnotify_mark *mark;
|
||||
struct hlist_node *pos;
|
||||
__u32 new_mask = 0;
|
||||
|
||||
assert_spin_locked(&mnt->mnt_root->d_lock);
|
||||
|
||||
hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list)
|
||||
hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list)
|
||||
new_mask |= mark->mask;
|
||||
mnt->mnt_fsnotify_mask = new_mask;
|
||||
m->mnt_fsnotify_mask = new_mask;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -101,12 +104,13 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark)
|
||||
static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group,
|
||||
struct vfsmount *mnt)
|
||||
{
|
||||
struct mount *m = real_mount(mnt);
|
||||
struct fsnotify_mark *mark;
|
||||
struct hlist_node *pos;
|
||||
|
||||
assert_spin_locked(&mnt->mnt_root->d_lock);
|
||||
|
||||
hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) {
|
||||
hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list) {
|
||||
if (mark->group == group) {
|
||||
fsnotify_get_mark(mark);
|
||||
return mark;
|
||||
@@ -140,6 +144,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
|
||||
struct fsnotify_group *group, struct vfsmount *mnt,
|
||||
int allow_dups)
|
||||
{
|
||||
struct mount *m = real_mount(mnt);
|
||||
struct fsnotify_mark *lmark;
|
||||
struct hlist_node *node, *last = NULL;
|
||||
int ret = 0;
|
||||
@@ -154,13 +159,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
|
||||
mark->m.mnt = mnt;
|
||||
|
||||
/* is mark the first mark? */
|
||||
if (hlist_empty(&mnt->mnt_fsnotify_marks)) {
|
||||
hlist_add_head_rcu(&mark->m.m_list, &mnt->mnt_fsnotify_marks);
|
||||
if (hlist_empty(&m->mnt_fsnotify_marks)) {
|
||||
hlist_add_head_rcu(&mark->m.m_list, &m->mnt_fsnotify_marks);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* should mark be in the middle of the current list? */
|
||||
hlist_for_each_entry(lmark, node, &mnt->mnt_fsnotify_marks, m.m_list) {
|
||||
hlist_for_each_entry(lmark, node, &m->mnt_fsnotify_marks, m.m_list) {
|
||||
last = node;
|
||||
|
||||
if ((lmark->group == group) && !allow_dups) {
|
||||
|
||||
Reference in New Issue
Block a user