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

This Linux kernel change "debugfs: 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:08 2019 +0300. The commit for this change in Linux stable tree is 6679ea6 (patch).

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

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

Cc: Greg Kroah-Hartman <>
Reviewed-by: Greg Kroah-Hartman <>
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/debugfs/inode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index d89874d..1e444fe 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -643,8 +643,11 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
        if (d_is_dir(dentry)) {
            ret = simple_rmdir(d_inode(parent), dentry);
+           if (!ret)
+               fsnotify_rmdir(d_inode(parent), dentry);
        } else {
            simple_unlink(d_inode(parent), dentry);
+           fsnotify_unlink(d_inode(parent), dentry);
        if (!ret)

Leave a Reply

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