On Sat, Oct 23, 2021 at 11:10:08AM +0100, Richard W.M. Jones wrote:
Sorry for a delayed reply,
>
> Fixing this in nbd_unlock_poll() avoids this issue in the entire
> library, when we wait for command completion. This seems more useful
> that fixing it in all libnbd clients.
>
> - r = poll (fds, 1, timeout);
> - debug (h, "poll end: r=%d revents=%x", r, fds[0].revents);
> + do {
> + r = poll (fds, 1, timeout);
> + debug (h, "poll end: r=%d revents=%x", r, fds[0].revents);
> + } while (r == -1 && errno == EINTR);
> +
> if (r == -1) {
> set_error (errno, "poll");
> return -1;
I think this is a perfectly reasonable solution, and better than
modifying the language bindings. I guess Eric should have the final
word here, but from my point of view ACK.
Whether a syscall fails with EINTR depends on which signal handlers
the application has installed. But as the library can't control which
signal handlers may or may not be modified by the rest of the
application, having the library assume that EINTR is always possible
is indeed more robust, and nicer than forcing every user of the
library to deal with the fallout for the library choking on EINTR.
ACK from me as well.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org