mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 08:14:35 +08:00
io_uring: remove req cancel in ->flush()
Every close(io_uring) causes cancellation of all inflight requests carrying ->files. That's not nice but was neccessary up until recently. Now task->files removal is handled in the core code, so that part of flush can be removed. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
43c01fbefd
commit
c8fb20b5b4
@ -8684,19 +8684,11 @@ static void io_uring_del_task_file(struct file *file)
|
|||||||
fput(file);
|
fput(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __io_uring_attempt_task_drop(struct file *file)
|
|
||||||
{
|
|
||||||
struct file *old = xa_load(¤t->io_uring->xa, (unsigned long)file);
|
|
||||||
|
|
||||||
if (old == file)
|
|
||||||
io_uring_del_task_file(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drop task note for this file if we're the only ones that hold it after
|
* Drop task note for this file if we're the only ones that hold it after
|
||||||
* pending fput()
|
* pending fput()
|
||||||
*/
|
*/
|
||||||
static void io_uring_attempt_task_drop(struct file *file, bool exiting)
|
static void io_uring_attempt_task_drop(struct file *file)
|
||||||
{
|
{
|
||||||
if (!current->io_uring)
|
if (!current->io_uring)
|
||||||
return;
|
return;
|
||||||
@ -8704,10 +8696,9 @@ static void io_uring_attempt_task_drop(struct file *file, bool exiting)
|
|||||||
* fput() is pending, will be 2 if the only other ref is our potential
|
* fput() is pending, will be 2 if the only other ref is our potential
|
||||||
* task file note. If the task is exiting, drop regardless of count.
|
* task file note. If the task is exiting, drop regardless of count.
|
||||||
*/
|
*/
|
||||||
if (!exiting && atomic_long_read(&file->f_count) != 2)
|
if (fatal_signal_pending(current) || (current->flags & PF_EXITING) ||
|
||||||
return;
|
atomic_long_read(&file->f_count) == 2)
|
||||||
|
io_uring_del_task_file(file);
|
||||||
__io_uring_attempt_task_drop(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __io_uring_files_cancel(struct files_struct *files)
|
void __io_uring_files_cancel(struct files_struct *files)
|
||||||
@ -8765,16 +8756,7 @@ void __io_uring_task_cancel(void)
|
|||||||
|
|
||||||
static int io_uring_flush(struct file *file, void *data)
|
static int io_uring_flush(struct file *file, void *data)
|
||||||
{
|
{
|
||||||
struct io_ring_ctx *ctx = file->private_data;
|
io_uring_attempt_task_drop(file);
|
||||||
|
|
||||||
/*
|
|
||||||
* If the task is going away, cancel work it may have pending
|
|
||||||
*/
|
|
||||||
if (fatal_signal_pending(current) || (current->flags & PF_EXITING))
|
|
||||||
data = NULL;
|
|
||||||
|
|
||||||
io_uring_cancel_task_requests(ctx, data);
|
|
||||||
io_uring_attempt_task_drop(file, !data);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user