nodedev: Signal initCond with driver locked

This is more academic dispute than a real bug, but this is taken
from pthread_cond_broadcast(3p) man:

  The pthread_cond_broadcast() or pthread_cond_signal() functions
  may be called by a thread whether or not it currently owns the
  mutex that threads calling pthread_cond_wait() or
  pthread_cond_timedwait() have associated with the condition
  variable during their waits; however, if predictable scheduling
  behavior is required, then that mutex shall be locked by the
  thread calling pthread_cond_broadcast() or
  pthread_cond_signal().

Therefore, broadcast the initCond while the nodedev driver is
still locked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2021-04-13 10:52:07 +02:00
parent 72e3fc595e
commit 5b56a288ca

View File

@ -1984,8 +1984,8 @@ nodeStateInitializeEnumerate(void *opaque)
nodeDeviceLock();
driver->initialized = true;
nodeDeviceUnlock();
virCondBroadcast(&driver->initCond);
nodeDeviceUnlock();
return;