aboutsummaryrefslogtreecommitdiff
path: root/fs/kernfs/file.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-09-19 12:30:55 +0800
committerAlex Shi <alex.shi@linaro.org>2016-09-19 12:30:55 +0800
commitfe522b1745154e8889a04b87e76d53ccece41d4a (patch)
treea3936cc8a12b60bcb2f5d7dd73ae48d7dbf55f81 /fs/kernfs/file.c
parent3b5fdc0c9bc5279975f1c775a2d7dd4ccbf2f40f (diff)
parenta8e202812b52b88e2a33d52687b3b0260706231a (diff)
Merge tag 'v3.18.42' into linux-linaro-lsk-v3.18lsk-v3.18-16.09
This is the 3.18.42 stable release
Diffstat (limited to 'fs/kernfs/file.c')
-rw-r--r--fs/kernfs/file.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index 4429d6d9217f..efb1f7b5883e 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -828,21 +828,35 @@ repeat:
mutex_lock(&kernfs_mutex);
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
+ struct kernfs_node *parent;
struct inode *inode;
- struct dentry *dentry;
+ /*
+ * We want fsnotify_modify() on @kn but as the
+ * modifications aren't originating from userland don't
+ * have the matching @file available. Look up the inodes
+ * and generate the events manually.
+ */
inode = ilookup(info->sb, kn->ino);
if (!inode)
continue;
- dentry = d_find_any_alias(inode);
- if (dentry) {
- fsnotify_parent(NULL, dentry, FS_MODIFY);
- fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
- NULL, 0);
- dput(dentry);
+ parent = kernfs_get_parent(kn);
+ if (parent) {
+ struct inode *p_inode;
+
+ p_inode = ilookup(info->sb, parent->ino);
+ if (p_inode) {
+ fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
+ inode, FSNOTIFY_EVENT_INODE, kn->name, 0);
+ iput(p_inode);
+ }
+
+ kernfs_put(parent);
}
+ fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
+ kn->name, 0);
iput(inode);
}