|
@@ -119,9 +119,9 @@ static void __fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
|
|
if (mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED)
|
|
if (mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED)
|
|
new_mask |= mark->mask;
|
|
new_mask |= mark->mask;
|
|
}
|
|
}
|
|
- if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
|
|
|
|
|
|
+ if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
|
|
conn->inode->i_fsnotify_mask = new_mask;
|
|
conn->inode->i_fsnotify_mask = new_mask;
|
|
- else if (conn->flags & FSNOTIFY_OBJ_TYPE_VFSMOUNT)
|
|
|
|
|
|
+ else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT)
|
|
real_mount(conn->mnt)->mnt_fsnotify_mask = new_mask;
|
|
real_mount(conn->mnt)->mnt_fsnotify_mask = new_mask;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -139,7 +139,7 @@ void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
|
|
spin_lock(&conn->lock);
|
|
spin_lock(&conn->lock);
|
|
__fsnotify_recalc_mask(conn);
|
|
__fsnotify_recalc_mask(conn);
|
|
spin_unlock(&conn->lock);
|
|
spin_unlock(&conn->lock);
|
|
- if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
|
|
|
|
|
|
+ if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
|
|
__fsnotify_update_child_dentry_flags(conn->inode);
|
|
__fsnotify_update_child_dentry_flags(conn->inode);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -166,18 +166,18 @@ static struct inode *fsnotify_detach_connector_from_object(
|
|
{
|
|
{
|
|
struct inode *inode = NULL;
|
|
struct inode *inode = NULL;
|
|
|
|
|
|
- if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE) {
|
|
|
|
|
|
+ if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
|
|
inode = conn->inode;
|
|
inode = conn->inode;
|
|
rcu_assign_pointer(inode->i_fsnotify_marks, NULL);
|
|
rcu_assign_pointer(inode->i_fsnotify_marks, NULL);
|
|
inode->i_fsnotify_mask = 0;
|
|
inode->i_fsnotify_mask = 0;
|
|
conn->inode = NULL;
|
|
conn->inode = NULL;
|
|
- conn->flags &= ~FSNOTIFY_OBJ_TYPE_INODE;
|
|
|
|
- } else if (conn->flags & FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
|
|
|
|
|
|
+ conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
|
|
|
|
+ } else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
|
|
rcu_assign_pointer(real_mount(conn->mnt)->mnt_fsnotify_marks,
|
|
rcu_assign_pointer(real_mount(conn->mnt)->mnt_fsnotify_marks,
|
|
NULL);
|
|
NULL);
|
|
real_mount(conn->mnt)->mnt_fsnotify_mask = 0;
|
|
real_mount(conn->mnt)->mnt_fsnotify_mask = 0;
|
|
conn->mnt = NULL;
|
|
conn->mnt = NULL;
|
|
- conn->flags &= ~FSNOTIFY_OBJ_TYPE_VFSMOUNT;
|
|
|
|
|
|
+ conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
|
|
}
|
|
}
|
|
|
|
|
|
return inode;
|
|
return inode;
|
|
@@ -442,10 +442,10 @@ static int fsnotify_attach_connector_to_object(
|
|
spin_lock_init(&conn->lock);
|
|
spin_lock_init(&conn->lock);
|
|
INIT_HLIST_HEAD(&conn->list);
|
|
INIT_HLIST_HEAD(&conn->list);
|
|
if (inode) {
|
|
if (inode) {
|
|
- conn->flags = FSNOTIFY_OBJ_TYPE_INODE;
|
|
|
|
|
|
+ conn->type = FSNOTIFY_OBJ_TYPE_INODE;
|
|
conn->inode = igrab(inode);
|
|
conn->inode = igrab(inode);
|
|
} else {
|
|
} else {
|
|
- conn->flags = FSNOTIFY_OBJ_TYPE_VFSMOUNT;
|
|
|
|
|
|
+ conn->type = FSNOTIFY_OBJ_TYPE_VFSMOUNT;
|
|
conn->mnt = mnt;
|
|
conn->mnt = mnt;
|
|
}
|
|
}
|
|
/*
|
|
/*
|
|
@@ -479,8 +479,7 @@ static struct fsnotify_mark_connector *fsnotify_grab_connector(
|
|
if (!conn)
|
|
if (!conn)
|
|
goto out;
|
|
goto out;
|
|
spin_lock(&conn->lock);
|
|
spin_lock(&conn->lock);
|
|
- if (!(conn->flags & (FSNOTIFY_OBJ_TYPE_INODE |
|
|
|
|
- FSNOTIFY_OBJ_TYPE_VFSMOUNT))) {
|
|
|
|
|
|
+ if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) {
|
|
spin_unlock(&conn->lock);
|
|
spin_unlock(&conn->lock);
|
|
srcu_read_unlock(&fsnotify_mark_srcu, idx);
|
|
srcu_read_unlock(&fsnotify_mark_srcu, idx);
|
|
return NULL;
|
|
return NULL;
|
|
@@ -646,16 +645,16 @@ struct fsnotify_mark *fsnotify_find_mark(
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-/* Clear any marks in a group with given type */
|
|
|
|
|
|
+/* Clear any marks in a group with given type mask */
|
|
void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
|
|
void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
|
|
- unsigned int type)
|
|
|
|
|
|
+ unsigned int type_mask)
|
|
{
|
|
{
|
|
struct fsnotify_mark *lmark, *mark;
|
|
struct fsnotify_mark *lmark, *mark;
|
|
LIST_HEAD(to_free);
|
|
LIST_HEAD(to_free);
|
|
struct list_head *head = &to_free;
|
|
struct list_head *head = &to_free;
|
|
|
|
|
|
/* Skip selection step if we want to clear all marks. */
|
|
/* Skip selection step if we want to clear all marks. */
|
|
- if (type == FSNOTIFY_OBJ_ALL_TYPES) {
|
|
|
|
|
|
+ if (type_mask == FSNOTIFY_OBJ_ALL_TYPES_MASK) {
|
|
head = &group->marks_list;
|
|
head = &group->marks_list;
|
|
goto clear;
|
|
goto clear;
|
|
}
|
|
}
|
|
@@ -670,7 +669,7 @@ void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
|
|
*/
|
|
*/
|
|
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
|
|
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
|
|
list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
|
|
list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
|
|
- if (mark->connector->flags & type)
|
|
|
|
|
|
+ if ((1U << mark->connector->type) & type_mask)
|
|
list_move(&mark->g_list, &to_free);
|
|
list_move(&mark->g_list, &to_free);
|
|
}
|
|
}
|
|
mutex_unlock(&group->mark_mutex);
|
|
mutex_unlock(&group->mark_mutex);
|