Commit e6983afd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull fsnotify updates from Jan Kara:
 "This contains cleanups of the fsnotify name removal hook and also a
  patch to disable fanotify permission events for 'proc' filesystem"

* tag 'fsnotify_for_v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fsnotify: get rid of fsnotify_nameremove()
  fsnotify: move fsnotify_nameremove() hook out of d_delete()
  configfs: call fsnotify_rmdir() hook
  debugfs: call fsnotify_{unlink,rmdir}() hooks
  debugfs: simplify __debugfs_remove_file()
  devpts: call fsnotify_unlink() hook
  tracefs: call fsnotify_{unlink,rmdir}() hooks
  rpc_pipefs: call fsnotify_{unlink,rmdir}() hooks
  btrfs: call fsnotify_rmdir() hook
  fsnotify: add empty fsnotify_{unlink,rmdir}() hooks
  fanotify: Disallow permission events for proc filesystem
parents 988052f4 7377f5be
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -60,11 +60,6 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode
		if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
			afs_edit_dir_add(dvnode, &new->d_name,
					 &vnode->fid, afs_edit_dir_for_silly_1);

		/* vfs_unlink and the like do not issue this when a file is
		 * sillyrenamed, so do it here.
		 */
		fsnotify_nameremove(old, 0);
	}

	kfree(scb);
+3 −1
Original line number Diff line number Diff line
@@ -2928,8 +2928,10 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
	inode_lock(inode);
	err = btrfs_delete_subvolume(dir, dentry);
	inode_unlock(inode);
	if (!err)
	if (!err) {
		fsnotify_rmdir(dir, dentry);
		d_delete(dentry);
	}

out_dput:
	dput(dentry);
+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#undef DEBUG

#include <linux/fs.h>
#include <linux/fsnotify.h>
#include <linux/mount.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -1788,6 +1789,7 @@ void configfs_unregister_group(struct config_group *group)
	configfs_detach_group(&group->cg_item);
	d_inode(dentry)->i_flags |= S_DEAD;
	dont_mount(dentry);
	fsnotify_rmdir(d_inode(parent), dentry);
	d_delete(dentry);
	inode_unlock(d_inode(parent));

@@ -1916,6 +1918,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
	configfs_detach_group(&group->cg_item);
	d_inode(dentry)->i_flags |= S_DEAD;
	dont_mount(dentry);
	fsnotify_rmdir(d_inode(root), dentry);
	inode_unlock(d_inode(dentry));

	d_delete(dentry);
+0 −2
Original line number Diff line number Diff line
@@ -2372,7 +2372,6 @@ EXPORT_SYMBOL(d_hash_and_lookup);
void d_delete(struct dentry * dentry)
{
	struct inode *inode = dentry->d_inode;
	int isdir = d_is_dir(dentry);

	spin_lock(&inode->i_lock);
	spin_lock(&dentry->d_lock);
@@ -2387,7 +2386,6 @@ void d_delete(struct dentry * dentry)
		spin_unlock(&dentry->d_lock);
		spin_unlock(&inode->i_lock);
	}
	fsnotify_nameremove(dentry, isdir);
}
EXPORT_SYMBOL(d_delete);

+10 −11
Original line number Diff line number Diff line
@@ -617,13 +617,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
@@ -644,16 +641,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))
		if (d_is_dir(dentry)) {
			ret = simple_rmdir(d_inode(parent), dentry);
			else
				simple_unlink(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;
Loading