aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 21:24:21 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:48 -0400
commit28c60e37f874dcbb93c4afc839ba5e4911c4f4bc (patch)
tree6f0ba450d42e9e9d6cc5be2e42dc846f00c44447 /fs
parent2a12a9d7814631e918dec93abad856e692d5286d (diff)
fsnotify: send struct file when sending events to parents when possible
fanotify needs a path in order to open an fd to the object which changed. Currently notifications to inode's parents are done using only the inode. For some parental notification we have the entire file, send that so fanotify can use it. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/fsnotify.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 523337b600a0..806beede24a3 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -78,13 +78,16 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
78} 78}
79 79
80/* Notify this dentry's parent about a child's events. */ 80/* Notify this dentry's parent about a child's events. */
81void __fsnotify_parent(struct dentry *dentry, __u32 mask) 81void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
82{ 82{
83 struct dentry *parent; 83 struct dentry *parent;
84 struct inode *p_inode; 84 struct inode *p_inode;
85 bool send = false; 85 bool send = false;
86 bool should_update_children = false; 86 bool should_update_children = false;
87 87
88 if (file)
89 dentry = file->f_path.dentry;
90
88 if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) 91 if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED))
89 return; 92 return;
90 93
@@ -115,8 +118,12 @@ void __fsnotify_parent(struct dentry *dentry, __u32 mask)
115 * specifies these are events which came from a child. */ 118 * specifies these are events which came from a child. */
116 mask |= FS_EVENT_ON_CHILD; 119 mask |= FS_EVENT_ON_CHILD;
117 120
118 fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, 121 if (file)
119 dentry->d_name.name, 0); 122 fsnotify(p_inode, mask, file, FSNOTIFY_EVENT_FILE,
123 dentry->d_name.name, 0);
124 else
125 fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
126 dentry->d_name.name, 0);
120 dput(parent); 127 dput(parent);
121 } 128 }
122 129