提交 385e3ed4 编写于 作者: R Roland Dreier 提交者: Al Viro

alloc_file(): simplify handling of mnt_clone_write() errors

When alloc_file() and init_file() were combined, the error handling of
mnt_clone_write() was taken into alloc_file() in a somewhat obfuscated
way.  Since we don't use the error code for anything except warning,
we might as well warn directly without an extra variable.
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 f7b84a6b
......@@ -186,10 +186,8 @@ struct file *alloc_file(struct path *path, fmode_t mode,
* that we can do debugging checks at __fput()
*/
if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) {
int error = 0;
file_take_write(file);
error = mnt_clone_write(path->mnt);
WARN_ON(error);
WARN_ON(mnt_clone_write(path->mnt));
}
ima_counts_get(file);
return file;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册