Re: [PATCH] libvirtd: fix potential deadlock when starting vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10/11/18 4:13 AM, Bingsong Si wrote:
> On CentOS 6, udev_monitor_receive_device will block until the socket becomes

Is this really CentOS6 only or just where you've seen it?

> readable, udevEventHandleThread will hold the lock all the time and
> udevEventHandleCallback hard to get the lock, will block the event poll.
> To fix this, set dataReady to false after receive an udev event.
> 
> Signed-off-by: Bingsong Si <owen.si@xxxxxxxxx>
> ---
>  src/node_device/node_device_udev.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 

I've CC'd Erik since he wrote and perhaps remembers all the "gotchas" he
discovered in the udev callback code.

I wonder if this has to do with the EAGAIN and EWOULDBLOCK @errno checks
done in the !device loop that are different in "older" (much older) code.

Although I have this very vague recollection that there was some problem
with centos6 that was fixed by some OS patch.  Hopefully Erik remembers
(and maybe we should log it in the code at this point ;-)) - I did do
some searching, but came up empty.

John

> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 22897591de..ce1101d7cc 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1616,6 +1616,7 @@ udevEventHandleThread(void *opaque ATTRIBUTE_UNUSED)
>  
>          errno = 0;
>          device = udev_monitor_receive_device(priv->udev_monitor);
> +        priv->dataReady = false;
>          virObjectUnlock(priv);
>  
>          if (!device) {
> @@ -1637,10 +1638,6 @@ udevEventHandleThread(void *opaque ATTRIBUTE_UNUSED)
>                  return;
>              }
>  
> -            virObjectLock(priv);
> -            priv->dataReady = false;
> -            virObjectUnlock(priv);
> -
>              continue;
>          }
>  
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux