• S
    Change locking for udev monitor and callbacks · 28795828
    Serge Hallyn 提交于
    We're seeing bugs apparently resulting from thread unsafety of
    libpciaccess, such as
    https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/726099
    To prevent those, as suggested by danpb on irc, move the
    nodeDeviceLock(driverState) higher into the callers.  In
    particular:
    
      udevDeviceMonitorStartup should hold the lock while calling
      udevEnumerateDevices(), and udevEventHandleCallback should hold it
      over its entire execution.
    
    It's not clear to me whether it is ok to hold the
    nodeDeviceLock while taking the virNodeDeviceObjLock(dev) on a
    device.  If not, then the lock will need to be dropped around
    the calling of udevSetupSystemDev(), and udevAddOneDevice()
    may not actually be safe to call from higher layers with the
    driverstate lock held.
    
    libvirt 0.8.8 with this patch on it seems to work fine for me.
    Assuming it looks ok and I haven't done anything obviously dumb,
    I'll ask the bug submitters to try this patch.
    Signed-off-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
    28795828
node_device_udev.c 46.4 KB