Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2017 17:29:35 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326798 - head/sys/geom/mirror
Message-ID:  <201712121729.vBCHTZdV075014@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712121729.vBCHTZdV075014>