Skip to content
Permalink
Browse files

rbd: krbd: return -ETIMEDOUT in polling

We don't want to wait on uevent forever, but the return value
of polling in timeout is 0 rather than a negative value.

Fixes: http://tracker.ceph.com/issues/38792
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
  • Loading branch information...
yangdongsheng committed Mar 18, 2019
1 parent ba556a7 commit ab833b823bf7dc5750f281a81f31ed8f708df73d
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/krbd.cc
@@ -241,12 +241,17 @@ static int wait_for_udev_add(struct udev_monitor *mon, const krbd_spec& spec,
for (;;) {
struct pollfd fds[1];
struct udev_device *dev;
int r;

fds[0].fd = udev_monitor_get_fd(mon);
fds[0].events = POLLIN;
if (poll(fds, 1, POLL_TIMEOUT) < 0)
r = poll(fds, 1, POLL_TIMEOUT);
if (r < 0)
return -errno;

if (r == 0)
return -ETIMEDOUT;

dev = udev_monitor_receive_device(mon);
if (!dev)
continue;
@@ -572,12 +577,17 @@ static int wait_for_udev_remove(struct udev_monitor *mon, dev_t devno)
for (;;) {
struct pollfd fds[1];
struct udev_device *dev;
int r;

fds[0].fd = udev_monitor_get_fd(mon);
fds[0].events = POLLIN;
if (poll(fds, 1, POLL_TIMEOUT) < 0)
r = poll(fds, 1, POLL_TIMEOUT);
if (r < 0)
return -errno;

if (r == 0)
return -ETIMEDOUT;

dev = udev_monitor_receive_device(mon);
if (!dev)
continue;

0 comments on commit ab833b8

Please sign in to comment.
You can’t perform that action at this time.