Merge tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / fs / debugfs / inode.c
index 5836312269e0714397a58840471509453650beea..042b688ed124a98052cf61ade8c996b4e42eb118 100644 (file)
@@ -639,13 +639,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
 }
 EXPORT_SYMBOL_GPL(debugfs_create_symlink);
 
-static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent)
+static void __debugfs_file_removed(struct dentry *dentry)
 {
        struct debugfs_fsdata *fsd;
 
-       simple_unlink(d_inode(parent), dentry);
-       d_delete(dentry);
-
        /*
         * Paired with the closing smp_mb() implied by a successful
         * cmpxchg() in debugfs_file_get(): either
@@ -666,16 +663,18 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
 
        if (simple_positive(dentry)) {
                dget(dentry);
-               if (!d_is_reg(dentry)) {
-                       if (d_is_dir(dentry))
-                               ret = simple_rmdir(d_inode(parent), dentry);
-                       else
-                               simple_unlink(d_inode(parent), dentry);
+               if (d_is_dir(dentry)) {
+                       ret = simple_rmdir(d_inode(parent), dentry);
                        if (!ret)
-                               d_delete(dentry);
+                               fsnotify_rmdir(d_inode(parent), dentry);
                } else {
-                       __debugfs_remove_file(dentry, parent);
+                       simple_unlink(d_inode(parent), dentry);
+                       fsnotify_unlink(d_inode(parent), dentry);
                }
+               if (!ret)
+                       d_delete(dentry);
+               if (d_is_reg(dentry))
+                       __debugfs_file_removed(dentry);
                dput(dentry);
        }
        return ret;