From 3a2dec17459dea56331430c8481646d538278518 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 20 Feb 2019 21:13:56 +0000 Subject: sna: Repeat udev_monitor_get_device() if interrupted In case udev_monitor_get_device() itself does not handle being interrupted, go around the loop again. Daniel Vetter discovered this interesting quirk during igt testing of kms_leases. Signed-off-by: Chris Wilson --- src/sna/sna_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index bb0c5fcf..754b2d4f 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -802,9 +802,14 @@ sna_handle_uevents(int fd, void *closure) struct udev_device *dev; dev_t devnum; + errno = 0; dev = udev_monitor_receive_device(sna->uevent_monitor); - if (dev == NULL) + if (dev == NULL) { + if (errno == EINTR || errno == EAGAIN) + continue; + break; + } devnum = udev_device_get_devnum(dev); if (memcmp(&s.st_rdev, &devnum, sizeof(dev_t)) == 0) { -- cgit v1.2.3