mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
inotify: do not set FS_EVENT_ON_CHILD in non-dir mark mask
FS_EVENT_ON_CHILD has currently no meaning for non-dir inode marks. In the following patches we want to use that bit to mean that mark's notification group cares about parent and name information. So stop setting FS_EVENT_ON_CHILD for non-dir marks. Link: https://lore.kernel.org/r/20200722125849.17418-3-amir73il@gmail.com Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
40a100d3ad
commit
957f7b472c
@ -75,15 +75,17 @@ struct ctl_table inotify_table[] = {
|
|||||||
};
|
};
|
||||||
#endif /* CONFIG_SYSCTL */
|
#endif /* CONFIG_SYSCTL */
|
||||||
|
|
||||||
static inline __u32 inotify_arg_to_mask(u32 arg)
|
static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg)
|
||||||
{
|
{
|
||||||
__u32 mask;
|
__u32 mask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* everything should accept their own ignored, cares about children,
|
* Everything should accept their own ignored and should receive events
|
||||||
* and should receive events when the inode is unmounted
|
* when the inode is unmounted. All directories care about children.
|
||||||
*/
|
*/
|
||||||
mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD | FS_UNMOUNT);
|
mask = (FS_IN_IGNORED | FS_UNMOUNT);
|
||||||
|
if (S_ISDIR(inode->i_mode))
|
||||||
|
mask |= FS_EVENT_ON_CHILD;
|
||||||
|
|
||||||
/* mask off the flags used to open the fd */
|
/* mask off the flags used to open the fd */
|
||||||
mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK));
|
mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK));
|
||||||
@ -512,7 +514,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
|
|||||||
int create = (arg & IN_MASK_CREATE);
|
int create = (arg & IN_MASK_CREATE);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mask = inotify_arg_to_mask(arg);
|
mask = inotify_arg_to_mask(inode, arg);
|
||||||
|
|
||||||
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
|
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
|
||||||
if (!fsn_mark)
|
if (!fsn_mark)
|
||||||
@ -565,7 +567,7 @@ static int inotify_new_watch(struct fsnotify_group *group,
|
|||||||
struct idr *idr = &group->inotify_data.idr;
|
struct idr *idr = &group->inotify_data.idr;
|
||||||
spinlock_t *idr_lock = &group->inotify_data.idr_lock;
|
spinlock_t *idr_lock = &group->inotify_data.idr_lock;
|
||||||
|
|
||||||
mask = inotify_arg_to_mask(arg);
|
mask = inotify_arg_to_mask(inode, arg);
|
||||||
|
|
||||||
tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
|
tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
|
||||||
if (unlikely(!tmp_i_mark))
|
if (unlikely(!tmp_i_mark))
|
||||||
|
Loading…
Reference in New Issue
Block a user