提交 a58de7a2 编写于 作者: A Amir Goldstein 提交者: Yang Yingliang

debugfs: simplify __debugfs_remove_file()

mainline inclusion
from mainline-5.3-rc1
commit 823e545c027795997f29ec5c255aff605cf39e85
category: bugfix
bugzilla: 24454
CVE: MA

---------------------------

Move simple_unlink()+d_delete() from __debugfs_remove_file() into
caller __debugfs_remove() and rename helper for post remove file to
__debugfs_file_removed().

This will simplify adding fsnotify_unlink() hook.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
Signed-off-by: NJan Kara <jack@suse.cz>
Signed-off-by: Nyu kuai <yukuai3@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a5e52dd3
......@@ -620,13 +620,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
......@@ -647,16 +644,15 @@ 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
} else {
simple_unlink(d_inode(parent), dentry);
}
if (!ret)
d_delete(dentry);
} else {
__debugfs_remove_file(dentry, parent);
}
if (d_is_reg(dentry))
__debugfs_file_removed(dentry);
dput(dentry);
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册