diff options
author | Olaf Hering <olaf@aepfle.de> | 2024-11-05 09:14:04 +0100 |
---|---|---|
committer | Wei Liu <wei.liu@kernel.org> | 2024-12-09 18:44:14 +0000 |
commit | a9640fcdd400463442846677e62b8208b81cb031 (patch) | |
tree | 1ebaf79bb3f3e570585b2b75b841c7ee7d722b05 | |
parent | 67b5e1042d90d8a9814f22312c1147b4c9cd501a (diff) |
tools/hv: terminate fcopy daemon if read from uio fails
Terminate endless loop in reading fails, to avoid flooding syslog.
This happens if the state of "Guest services" integration service
is changed from "enabled" to "disabled" at runtime in the VM
settings. In this case pread returns EIO.
Also handle an interrupted system call, and continue in this case.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Link: https://lore.kernel.org/r/20241105081437.15689-1-olaf@aepfle.de
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20241105081437.15689-1-olaf@aepfle.de>
-rw-r--r-- | tools/hv/hv_fcopy_uio_daemon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/hv/hv_fcopy_uio_daemon.c b/tools/hv/hv_fcopy_uio_daemon.c index 12743d7f164f..0198321d14a2 100644 --- a/tools/hv/hv_fcopy_uio_daemon.c +++ b/tools/hv/hv_fcopy_uio_daemon.c @@ -466,8 +466,10 @@ int main(int argc, char *argv[]) */ ret = pread(fcopy_fd, &tmp, sizeof(int), 0); if (ret < 0) { + if (errno == EINTR || errno == EAGAIN) + continue; syslog(LOG_ERR, "pread failed: %s", strerror(errno)); - continue; + goto close; } len = HV_RING_SIZE; |