Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2018 03:11:41 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327805 - head/sys/cam
Message-ID:  <201801110311.w0B3BfB7073744@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: imp
Date: Thu Jan 11 03:11:41 2018
New Revision: 327805
URL: https://svnweb.freebsd.org/changeset/base/327805

Log:
  When we crash, we'll stop the scheduler before we call the
  shutdown_post_sync event.  For adashutdown, this causes problems
  because we need to poll for completion of the commands, but we're not
  yet officially dumping yet, so the code from r326964 assumed we could
  use the interrupt-driven commands rather than the polled ones. This
  lead to a hang. Prevent this by also checking to see if the scheduler
  is stopped to do the polling.
  
  Reported by: markj@
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D13845

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c	Thu Jan 11 00:54:54 2018	(r327804)
+++ head/sys/cam/cam_periph.c	Thu Jan 11 03:11:41 2018	(r327805)
@@ -1187,10 +1187,16 @@ cam_periph_runccb(union ccb *ccb,
 	 * scheduler is running in this case, we still need to poll the I/O to
 	 * avoid sleeping waiting for the ccb to complete.
 	 *
-	 * XXX To avoid locking problems, dumping/polling callers must call
+	 * A panic triggered dump stops the scheduler, any callback from the
+	 * shutdown_post_sync event will run with the scheduler stopped, but
+	 * before we're officially dumping. To avoid hanging in adashutdown
+	 * initiated commands (or other similar situations), we have to test for
+	 * either SCHEDULER_STOPPED() here as well.
+	 *
+	 * To avoid locking problems, dumping/polling callers must call
 	 * without a periph lock held.
 	 */
-	must_poll = dumping;
+	must_poll = dumping || SCHEDULER_STOPPED();
 	ccb->ccb_h.cbfcnp = cam_periph_done;
 
 	/*



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201801110311.w0B3BfB7073744>