configfs: call fsnotify_rmdir() hook [Linux 5.3]

This Linux kernel change "configfs: call fsnotify_rmdir() hook" is included in the Linux 5.3 release. This change is authored by Amir Goldstein <amir73il [at]> on Sun May 26 17:34:09 2019 +0300. The commit for this change in Linux stable tree is 6146e78 (patch).

configfs: call fsnotify_rmdir() hook

This will allow generating fsnotify delete events on unregister
of group/subsystem after the fsnotify_nameremove() hook is removed
from d_delete().

The rest of the d_delete() calls from this filesystem are either
called recursively from within debugfs_unregister_{group,subsystem},
called from a vfs function that already has delete hooks or are
called from shutdown/cleanup code.

Cc: Joel Becker <>
Cc: Christoph Hellwig <>
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/configfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 5e7932d..ba17881 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -27,6 +27,7 @@
 #undef DEBUG

 #include <linux/fs.h>
+#include <linux/fsnotify.h>
 #include <linux/mount.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -1804,6 +1805,7 @@ void configfs_unregister_group(struct config_group *group)
    d_inode(dentry)->i_flags |= S_DEAD;
+   fsnotify_rmdir(d_inode(parent), dentry);

@@ -1932,6 +1934,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
    d_inode(dentry)->i_flags |= S_DEAD;
+   fsnotify_rmdir(d_inode(root), dentry);


Leave a Reply

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