]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
krbd: reap all available events before polling again
authorIlya Dryomov <idryomov@gmail.com>
Thu, 10 Oct 2019 11:49:26 +0000 (13:49 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 16 Oct 2019 14:56:10 +0000 (16:56 +0200)
This also exposes errors from udev_monitor_receive_device() which were
previously ignored.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/krbd.cc

index 4963fc8a3f7ba2fca6391642f854d6e4fb0c87c5..baae7e724962dd5b6ec777417e964ba3b96f6064 100644 (file)
@@ -234,18 +234,23 @@ static int wait_for_mapping(udev_monitor *mon, F udev_device_handler)
   fds[0].events = POLLIN;
 
   for (;;) {
-    struct udev_device *dev;
-
     if (poll(fds, 1, -1) < 0) {
       ceph_abort_msgf("poll failed: %d", -errno);
     }
 
-    dev = udev_monitor_receive_device(mon);
-    if (!dev) {
-      continue;
-    }
-    if (udev_device_handler(dev)) {
-      return 0;
+    for (;;) {
+      struct udev_device *dev;
+
+      dev = udev_monitor_receive_device(mon);
+      if (!dev) {
+        if (errno != EINTR && errno != EAGAIN) {
+          return -errno;
+        }
+        break;
+      }
+      if (udev_device_handler(dev)) {
+        return 0;
+      }
     }
   }
 }