tracefs: call fsnotify_{unlink,rmdir}() hooks [Linux 5.3]

This Linux kernel change "tracefs: call fsnotify_{unlink,rmdir}() hooks" is included in the Linux 5.3 release. This change is authored by Amir Goldstein <amir73il [at]> on Sun May 26 17:34:05 2019 +0300. The commit for this change in Linux stable tree is 4bf2377 (patch).

tracefs: call fsnotify_{unlink,rmdir}() hooks

This will allow generating fsnotify delete events after the
fsnotify_nameremove() hook is removed from d_delete().

Cc: Steven Rostedt <>
Signed-off-by: Amir Goldstein <>
Signed-off-by: Jan Kara <>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/tracefs/inode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 7098c49..497a868 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -509,9 +509,12 @@ static int __tracefs_remove(struct dentry *dentry, struct dentry *parent)
            switch (dentry->d_inode->i_mode & S_IFMT) {
            case S_IFDIR:
                ret = simple_rmdir(parent->d_inode, dentry);
+               if (!ret)
+                   fsnotify_rmdir(parent->d_inode, dentry);
                simple_unlink(parent->d_inode, dentry);
+               fsnotify_unlink(parent->d_inode, dentry);
            if (!ret)

Leave a Reply

Your email address will not be published. Required fields are marked *