Make bufdaemon and bufspacedaemon use kthread_suspend_check instead of

kproc_suspend_check.  In r329612 bufspacedaemon was turned into a thread
of the bufdaemon process causing both to call kproc_suspend_check with the
same proc argument and that function contains the following while loop:

while (SIGISMEMBER(p->p_siglist, SIGSTOP)) {
	wakeup(&p->p_siglist);
	msleep(&p->p_siglist, &p->p_mtx, PPAUSE, "kpsusp", 0);
}

So one thread wakes up the other and the other wakes up the first again,
locking up UP machines on shutdown.

Also register the shutdown handlers with SHUTDOWN_PRI_LAST + 100 so they
run after the syncer has shutdown, because the syncer can cause a
situation where bufdaemon help is needed to proceed.

PR:		227404
Reviewed by:	kib
Tested by:	cy, rmacklem
This commit is contained in:
Tijl Coosemans 2018-04-22 16:05:29 +00:00
parent 7d853f62bf
commit 7dfbbc613b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332871

View File

@ -791,9 +791,12 @@ bufspace_daemon(void *arg)
{
struct bufdomain *bd;
EVENTHANDLER_REGISTER(shutdown_pre_sync, kthread_shutdown, curthread,
SHUTDOWN_PRI_LAST + 100);
bd = arg;
for (;;) {
kproc_suspend_check(curproc);
kthread_suspend_check();
/*
* Free buffers from the clean queue until we meet our
@ -3357,8 +3360,8 @@ buf_daemon()
/*
* This process needs to be suspended prior to shutdown sync.
*/
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, bufdaemonproc,
SHUTDOWN_PRI_LAST);
EVENTHANDLER_REGISTER(shutdown_pre_sync, kthread_shutdown, curthread,
SHUTDOWN_PRI_LAST + 100);
/*
* Start the buf clean daemons as children threads.
@ -3381,7 +3384,7 @@ buf_daemon()
bd_request = 0;
mtx_unlock(&bdlock);
kproc_suspend_check(bufdaemonproc);
kthread_suspend_check();
/*
* Save speedupreq for this pass and reset to capture new