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
This commit is contained in:
markj 2017-12-12 17:29:34 +00:00
parent 1f07d15939
commit 48eee215b9

View File

@ -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);