Merge tag 'gfs2-v5.12-rc2-fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / signal.c
index f2a1b89..f271835 100644 (file)
@@ -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))