From: Olaf Hering <olaf@aepfle.de>
To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>
Subject: [PATCH v2] tools/hv: terminate fcopy daemon if read from uio fails
Date: Tue, 5 Nov 2024 09:14:04 +0100 [thread overview]
Message-ID: <20241105081437.15689-1-olaf@aepfle.de> (raw)
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>
---
v2: update commit message
A more complete fix is to handle this properly in the kernel,
by making the file descriptor unavailable for further operations.
tools/hv/hv_fcopy_uio_daemon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/hv/hv_fcopy_uio_daemon.c b/tools/hv/hv_fcopy_uio_daemon.c
index 7a00f3066a98..281fd95dc0d8 100644
--- a/tools/hv/hv_fcopy_uio_daemon.c
+++ b/tools/hv/hv_fcopy_uio_daemon.c
@@ -468,8 +468,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;
next reply other threads:[~2024-11-05 8:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 8:14 Olaf Hering [this message]
2024-11-05 8:38 ` [PATCH v2] tools/hv: terminate fcopy daemon if read from uio fails Saurabh Singh Sengar
2024-12-07 7:53 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105081437.15689-1-olaf@aepfle.de \
--to=olaf@aepfle.de \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox