]> 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>
Fri, 1 Nov 2019 16:01:06 +0000 (17:01 +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 da89f787891dd2885ebb464b44f01c2fcab5412e..bbf9f84446118e23bf09c37ac39c0d02eff88d20 100644 (file)
@@ -185,18 +185,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;
+      }
     }
   }
 }