Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

new helper: simple_remove_by_name()

simple_recursive_removal(), but instead of victim dentry it takes
parent + name.

Used to be open-coded in fs/fuse/control.c, but there's no need to expose
the guts of that thing there and there are other potential users, so
let's lift it into libfs...

Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 4051a911 798a4016

+16 -6
+1 -6
fs/fuse/control.c
··· 290 290 */ 291 291 void fuse_ctl_remove_conn(struct fuse_conn *fc) 292 292 { 293 - struct dentry *dentry; 294 293 char name[32]; 295 294 296 295 if (!fuse_control_sb || fc->no_control) 297 296 return; 298 297 299 298 sprintf(name, "%u", fc->dev); 300 - dentry = lookup_noperm_positive_unlocked(&QSTR(name), fuse_control_sb->s_root); 301 - if (!IS_ERR(dentry)) { 302 - simple_recursive_removal(dentry, remove_one); 303 - dput(dentry); // paired with lookup_noperm_positive_unlocked() 304 - } 299 + simple_remove_by_name(fuse_control_sb->s_root, name, remove_one); 305 300 } 306 301 307 302 static int fuse_ctl_fill_super(struct super_block *sb, struct fs_context *fsc)
+13
fs/libfs.c
··· 655 655 } 656 656 EXPORT_SYMBOL(simple_recursive_removal); 657 657 658 + void simple_remove_by_name(struct dentry *parent, const char *name, 659 + void (*callback)(struct dentry *)) 660 + { 661 + struct dentry *dentry; 662 + 663 + dentry = lookup_noperm_positive_unlocked(&QSTR(name), parent); 664 + if (!IS_ERR(dentry)) { 665 + simple_recursive_removal(dentry, callback); 666 + dput(dentry); // paired with lookup_noperm_positive_unlocked() 667 + } 668 + } 669 + EXPORT_SYMBOL(simple_remove_by_name); 670 + 658 671 /* caller holds parent directory with I_MUTEX_PARENT */ 659 672 void locked_recursive_removal(struct dentry *dentry, 660 673 void (*callback)(struct dentry *))
+2
include/linux/fs.h
··· 3631 3631 unsigned int); 3632 3632 extern void simple_recursive_removal(struct dentry *, 3633 3633 void (*callback)(struct dentry *)); 3634 + extern void simple_remove_by_name(struct dentry *, const char *, 3635 + void (*callback)(struct dentry *)); 3634 3636 extern void locked_recursive_removal(struct dentry *, 3635 3637 void (*callback)(struct dentry *)); 3636 3638 extern int noop_fsync(struct file *, loff_t, loff_t, int);