]> 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>
Mon, 4 Nov 2019 11:43:20 +0000 (12:43 +0100)
This also exposes errors from udev_monitor_receive_device() which were
previously ignored.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 53aab34dafcca2ec022102a03905e59cfa34fc84)

src/krbd.cc

index c68f38cefd5c33ecdc403c4d8233448b1f4a6f38..dcf13d57a19ee6e1bb91b3de66abd552d7984254 100644 (file)
@@ -183,18 +183,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();
     }
 
-    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;
+      }
     }
   }
 }