Commit fab51505 authored by Peter Xu's avatar Peter Xu Committed by Linus Torvalds

selftests/uffd: allow EINTR/EAGAIN

This allow test to continue with interruptions like gdb.

Link: https://lkml.kernel.org/r/20211115135219.85881-1-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
Reviewed-by: default avatarAxel Rasmussen <axelrasmussen@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 209376ed
...@@ -648,7 +648,7 @@ static int uffd_read_msg(int ufd, struct uffd_msg *msg) ...@@ -648,7 +648,7 @@ static int uffd_read_msg(int ufd, struct uffd_msg *msg)
if (ret != sizeof(*msg)) { if (ret != sizeof(*msg)) {
if (ret < 0) { if (ret < 0) {
if (errno == EAGAIN) if (errno == EAGAIN || errno == EINTR)
return 1; return 1;
err("blocking read error"); err("blocking read error");
} else { } else {
...@@ -724,8 +724,11 @@ static void *uffd_poll_thread(void *arg) ...@@ -724,8 +724,11 @@ static void *uffd_poll_thread(void *arg)
for (;;) { for (;;) {
ret = poll(pollfd, 2, -1); ret = poll(pollfd, 2, -1);
if (ret <= 0) if (ret <= 0) {
if (errno == EINTR || errno == EAGAIN)
continue;
err("poll error: %d", ret); err("poll error: %d", ret);
}
if (pollfd[1].revents & POLLIN) { if (pollfd[1].revents & POLLIN) {
if (read(pollfd[1].fd, &tmp_chr, 1) != 1) if (read(pollfd[1].fd, &tmp_chr, 1) != 1)
err("read pipefd error"); err("read pipefd error");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment