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:
Mark Johnston 2017-12-12 17:29:34 +00:00
parent b634781eac
commit 8b93770503
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326798

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