Merge tag 'io_uring-5.12-2021-03-27' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe:
- Use thread info versions of flag testing, as discussed last week.
- The series enabling PF_IO_WORKER to just take signals, instead of
needing to special case that they do not in a bunch of places. Ends
up being pretty trivial to do, and then we can revert all the special
casing we're currently doing.
- Kill dead pointer assignment
- Fix hashed part of async work queue trace
- Fix sign extension issue for IORING_OP_PROVIDE_BUFFERS
- Fix a link completion ordering regression in this merge window
- Cancellation fixes
* tag 'io_uring-5.12-2021-03-27' of git://git.kernel.dk/linux-block:
io_uring: remove unsued assignment to pointer io
io_uring: don't cancel extra on files match
io_uring: don't cancel-track common timeouts
io_uring: do post-completion chore on t-out cancel
io_uring: fix timeout cancel return code
Revert "signal: don't allow STOP on PF_IO_WORKER threads"
Revert "kernel: freezer should treat PF_IO_WORKER like PF_KTHREAD for freezing"
Revert "kernel: treat PF_IO_WORKER like PF_KTHREAD for ptrace/signals"
Revert "signal: don't allow sending any signals to PF_IO_WORKER threads"
kernel: stop masking signals in create_io_thread()
io_uring: handle signals for IO threads like a normal thread
kernel: don't call do_exit() for PF_IO_WORKER threads
io_uring: maintain CQE order of a failed link
io-wq: fix race around pending work on teardown
io_uring: do ctx sqd ejection in a clear context
io_uring: fix provide_buffers sign extension
io_uring: don't skip file_end_write() on reissue
io_uring: correct io_queue_async_work() traces
io_uring: don't use {test,clear}_tsk_thread_flag() for current
This commit is contained in:
@@ -1948,8 +1948,14 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
p = dup_task_struct(current, node);
|
||||
if (!p)
|
||||
goto fork_out;
|
||||
if (args->io_thread)
|
||||
if (args->io_thread) {
|
||||
/*
|
||||
* Mark us an IO worker, and block any signal that isn't
|
||||
* fatal or STOP
|
||||
*/
|
||||
p->flags |= PF_IO_WORKER;
|
||||
siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP));
|
||||
}
|
||||
|
||||
/*
|
||||
* This _must_ happen before we call free_task(), i.e. before we jump
|
||||
@@ -2438,14 +2444,8 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
|
||||
.stack_size = (unsigned long)arg,
|
||||
.io_thread = 1,
|
||||
};
|
||||
struct task_struct *tsk;
|
||||
|
||||
tsk = copy_process(NULL, 0, node, &args);
|
||||
if (!IS_ERR(tsk)) {
|
||||
sigfillset(&tsk->blocked);
|
||||
sigdelsetmask(&tsk->blocked, sigmask(SIGKILL));
|
||||
}
|
||||
return tsk;
|
||||
return copy_process(NULL, 0, node, &args);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -134,7 +134,7 @@ bool freeze_task(struct task_struct *p)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(p->flags & (PF_KTHREAD | PF_IO_WORKER)))
|
||||
if (!(p->flags & PF_KTHREAD))
|
||||
fake_signal_wake_up(p);
|
||||
else
|
||||
wake_up_state(p, TASK_INTERRUPTIBLE);
|
||||
|
||||
@@ -375,7 +375,7 @@ static int ptrace_attach(struct task_struct *task, long request,
|
||||
audit_ptrace(task);
|
||||
|
||||
retval = -EPERM;
|
||||
if (unlikely(task->flags & (PF_KTHREAD | PF_IO_WORKER)))
|
||||
if (unlikely(task->flags & PF_KTHREAD))
|
||||
goto out;
|
||||
if (same_thread_group(task, current))
|
||||
goto out;
|
||||
|
||||
@@ -91,7 +91,7 @@ static bool sig_task_ignored(struct task_struct *t, int sig, bool force)
|
||||
return true;
|
||||
|
||||
/* Only allow kernel generated signals to this kthread */
|
||||
if (unlikely((t->flags & (PF_KTHREAD | PF_IO_WORKER)) &&
|
||||
if (unlikely((t->flags & PF_KTHREAD) &&
|
||||
(handler == SIG_KTHREAD_KERNEL) && !force))
|
||||
return true;
|
||||
|
||||
@@ -288,8 +288,7 @@ bool task_set_jobctl_pending(struct task_struct *task, unsigned long mask)
|
||||
JOBCTL_STOP_SIGMASK | JOBCTL_TRAPPING));
|
||||
BUG_ON((mask & JOBCTL_TRAPPING) && !(mask & JOBCTL_PENDING_MASK));
|
||||
|
||||
if (unlikely(fatal_signal_pending(task) ||
|
||||
(task->flags & (PF_EXITING | PF_IO_WORKER))))
|
||||
if (unlikely(fatal_signal_pending(task) || (task->flags & PF_EXITING)))
|
||||
return false;
|
||||
|
||||
if (mask & JOBCTL_STOP_SIGMASK)
|
||||
@@ -834,9 +833,6 @@ static int check_kill_permission(int sig, struct kernel_siginfo *info,
|
||||
|
||||
if (!valid_signal(sig))
|
||||
return -EINVAL;
|
||||
/* PF_IO_WORKER threads don't take any signals */
|
||||
if (t->flags & PF_IO_WORKER)
|
||||
return -ESRCH;
|
||||
|
||||
if (!si_fromuser(info))
|
||||
return 0;
|
||||
@@ -1100,7 +1096,7 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
|
||||
/*
|
||||
* Skip useless siginfo allocation for SIGKILL and kernel threads.
|
||||
*/
|
||||
if ((sig == SIGKILL) || (t->flags & (PF_KTHREAD | PF_IO_WORKER)))
|
||||
if ((sig == SIGKILL) || (t->flags & PF_KTHREAD))
|
||||
goto out_set;
|
||||
|
||||
/*
|
||||
@@ -2771,6 +2767,14 @@ relock:
|
||||
do_coredump(&ksig->info);
|
||||
}
|
||||
|
||||
/*
|
||||
* PF_IO_WORKER threads will catch and exit on fatal signals
|
||||
* themselves. They have cleanup that must be performed, so
|
||||
* we cannot call do_exit() on their behalf.
|
||||
*/
|
||||
if (current->flags & PF_IO_WORKER)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Death signals, no core dump.
|
||||
*/
|
||||
@@ -2778,7 +2782,7 @@ relock:
|
||||
/* NOTREACHED */
|
||||
}
|
||||
spin_unlock_irq(&sighand->siglock);
|
||||
|
||||
out:
|
||||
ksig->sig = signr;
|
||||
|
||||
if (!(ksig->ka.sa.sa_flags & SA_EXPOSE_TAGBITS))
|
||||
|
||||
Reference in New Issue
Block a user