Signed-off-by: Christian Brauner --- fs/anon_inodes.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 180a458fc4f7..5b15547ca693 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c @@ -280,27 +280,14 @@ static int __anon_inode_getfd(const char *name, const struct inode *context_inode, bool make_inode) { - int error, fd; - struct file *file; + int error; - error = get_unused_fd_flags(flags); - if (error < 0) + FD_PREPARE(fdf, flags, __anon_inode_getfile(name, fops, priv, flags, + context_inode, make_inode)); + error = ACQUIRE_ERR(fd_prepare, &fdf); + if (error) return error; - fd = error; - - file = __anon_inode_getfile(name, fops, priv, flags, context_inode, - make_inode); - if (IS_ERR(file)) { - error = PTR_ERR(file); - goto err_put_unused_fd; - } - fd_install(fd, file); - - return fd; - -err_put_unused_fd: - put_unused_fd(fd); - return error; + return fd_publish(fdf); } /** -- 2.47.3