[DTrace-devel] [PATCH 05/23] dtprobed: handle signals hitting dtprobed better
Nick Alcock
nick.alcock at oracle.com
Thu Feb 22 18:39:01 UTC 2024
dtprobed is long-running and thus might get hit by signals at almost any
time. These will cause long-running operations to return -EINTR, which
needs handling. We were handling -EINTR when a fuse_session_receive_buf()
happened, but dtprobed spends almost all its time blocked on poll() and that
isn't handling -EINTR at all. This came to light when tests were written
that intentionally hit dtprobed with signals: fix it by checking the poll()
for EINTR too. (Done in two places because the core FUSE loop is duplicated
for FUSE 2 and 3.)
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
---
dtprobed/dtprobed.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dtprobed/dtprobed.c b/dtprobed/dtprobed.c
index 910b4773..4d21b3a2 100644
--- a/dtprobed/dtprobed.c
+++ b/dtprobed/dtprobed.c
@@ -779,8 +779,11 @@ loop(void)
fds[0].events = POLLIN;
while (!fuse_session_exited(cuse_session)) {
- if ((ret = poll(fds, 1, -1)) < 0)
+ if (poll(fds, 1, -1) < 0) {
+ if (errno == EINTR)
+ continue;
break;
+ }
if (fds[0].revents != 0) {
if ((ret = fuse_session_receive_buf(cuse_session,
@@ -822,8 +825,11 @@ loop(void)
struct fuse_buf fbuf = { .mem = buf, .size = bufsize };
struct fuse_chan *tmpch = cuse_chan;
- if ((ret = poll(fds, 1, -1)) < 0)
+ if (poll(fds, 1, -1) < 0) {
+ if (errno == EINTR)
+ continue;
break;
+ }
if (fds[0].revents != 0) {
if ((ret = fuse_session_receive_buf(cuse_session,
--
2.42.0
More information about the DTrace-devel
mailing list