svn commit: r326798 - head/sys/geom/mirror

Mark Johnston markj at FreeBSD.org
Tue Dec 12 17:29:36 UTC 2017


Author: markj
Date: Tue Dec 12 17:29:34 2017
New Revision: 326798
URL: https://svnweb.freebsd.org/changeset/base/326798

Log:
  Address a possible lost wakeup for gmirror events.
  
  g_mirror_event_send() acquires the I/O queue lock to deliver a wakeup
  to the worker thread, and this is done after enqueuing the event.
  So it's sufficient to check the event queue before atomically releasing
  the queue lock and going to sleep.
  
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==============================================================================
--- head/sys/geom/mirror/g_mirror.c	Tue Dec 12 17:25:25 2017	(r326797)
+++ head/sys/geom/mirror/g_mirror.c	Tue Dec 12 17:29:34 2017	(r326798)
@@ -1945,16 +1945,9 @@ g_mirror_worker(void *arg)
 					continue;
 				}
 			}
+			if (g_mirror_event_first(sc) != NULL)
+				continue;
 			sx_xunlock(&sc->sc_lock);
-			/*
-			 * XXX: We can miss an event here, because an event
-			 *      can be added without sx-device-lock and without
-			 *      mtx-queue-lock. Maybe I should just stop using
-			 *      dedicated mutex for events synchronization and
-			 *      stick with the queue lock?
-			 *      The event will hang here until next I/O request
-			 *      or next event is received.
-			 */
 			MSLEEP(sc, &sc->sc_queue_mtx, PRIBIO | PDROP, "m:w1",
 			    timeout * hz);
 			sx_xlock(&sc->sc_lock);


More information about the svn-src-head mailing list