OSDN Git Service

kernel: don't call do_exit() for PF_IO_WORKER threads
authorJens Axboe <axboe@kernel.dk>
Fri, 26 Mar 2021 14:57:10 +0000 (08:57 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 26 Mar 2021 22:10:14 +0000 (16:10 -0600)
Right now we're never calling get_signal() from PF_IO_WORKER threads, but
in preparation for doing so, don't handle a fatal signal for them. The
workers have state they need to cleanup when exiting, so just return
instead of calling do_exit() on their behalf. The threads themselves will
detect a fatal signal and do proper shutdown.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/signal.c

index f2a1b89..d22177d 100644 (file)
@@ -2772,13 +2772,21 @@ relock:
                }
 
                /*
+                * 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.
                 */
                do_group_exit(ksig->info.si_signo);
                /* NOTREACHED */
        }
        spin_unlock_irq(&sighand->siglock);
-
+out:
        ksig->sig = signr;
 
        if (!(ksig->ka.sa.sa_flags & SA_EXPOSE_TAGBITS))