mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
io_uring: refactor io_close
A small refactoring shrinking it and making easier to read. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/19b24eed7cd491a0243b50366dd2a23b558e2665.1618101759.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
3f48cf18f8
commit
a1fde923e3
@ -4181,11 +4181,9 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
struct files_struct *files = current->files;
|
struct files_struct *files = current->files;
|
||||||
struct io_close *close = &req->close;
|
struct io_close *close = &req->close;
|
||||||
struct fdtable *fdt;
|
struct fdtable *fdt;
|
||||||
struct file *file;
|
struct file *file = NULL;
|
||||||
int ret;
|
int ret = -EBADF;
|
||||||
|
|
||||||
file = NULL;
|
|
||||||
ret = -EBADF;
|
|
||||||
spin_lock(&files->file_lock);
|
spin_lock(&files->file_lock);
|
||||||
fdt = files_fdtable(files);
|
fdt = files_fdtable(files);
|
||||||
if (close->fd >= fdt->max_fds) {
|
if (close->fd >= fdt->max_fds) {
|
||||||
@ -4193,12 +4191,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
file = fdt->fd[close->fd];
|
file = fdt->fd[close->fd];
|
||||||
if (!file) {
|
if (!file || file->f_op == &io_uring_fops) {
|
||||||
spin_unlock(&files->file_lock);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file->f_op == &io_uring_fops) {
|
|
||||||
spin_unlock(&files->file_lock);
|
spin_unlock(&files->file_lock);
|
||||||
file = NULL;
|
file = NULL;
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user