Author: tijl
Date: Sun Apr 22 16:05:29 2018
New Revision: 332871
URL: https://svnweb.freebsd.org/changeset/base/332871

Log:
  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

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Sun Apr 22 09:30:07 2018        (r332870)
+++ head/sys/kern/vfs_bio.c     Sun Apr 22 16:05:29 2018        (r332871)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to