tools/hv: terminate fcopy daemon if read from uio fails
Subsystems (2)
PATCH 1/1 tools/hv: terminate fcopy daemon if read from uio fails
Terminate endless loop in reading fails, to avoid flooding syslog.
This happens if the "Guest services" integration service is disabled at runtime in the VM settings.
Also handle an interrupted system call, and continue in this case.
---
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(-)
tools/hv/hv_fcopy_uio_daemon.c +3 -1
@@ -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 ;
Quoted 21 lines · Olaf Hering
Terminate endless loop in reading fails, to avoid flooding syslog.
This happens if the "Guest services" integration service is disabled at runtime in the VM settings.
Also handle an interrupted system call, and continue in this case.
Signed-off-by Olaf Hering <[email protected]>---
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(-)tools/hv/hv_fcopy_uio_daemon.c +0
-0
tools/hv/hv_fcopy_uio_daemon.c int main(int argc, char *argv[]) · line 473
Quoted 6 lines
tools/hv/hv_fcopy_uio_daemon.c +2
-0@@ -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));
Thanks for the patch. Changes look good to me, I will suggest to improve this log message incase the error type is EIO by suggesting that users verify if 'Guest Services' is enabled.
- Saurabh
Mon, 28 Oct 2024 02:06:20 -0700 Saurabh Singh Sengar <[email protected]>:
Quoted 3 lines
Thanks for the patch. Changes look good to me, I will suggest to improve this log message incase the error type is EIO by suggesting that users verify if 'Guest Services' is enabled.
No error happens if the state of "Guest services" remains unchanged during the life time of the VM (either "enabled" or "disabled"). Also no error happens if "Guest services" changes from "disabled" to "enabled". But the error happens if "Guest services" changes from "enabled" to "disabled". I think the actual error "EIO" is not relevant for the commit message. Maybe you mean the second paragraph should read like this?
This happens if the state of "Guest services" integration service is changed from "enabled" to "disabled" at runtime in the VM settings.
I'm probably not telling news if I say that this behavior is a regression compared to the hv_utils based variant of fcopy. In the past one could flip the state of "Guest services", it would always come back if state changed to "enabled" again, because the "hv_fcopy" device node came back. With UIO the device node does not come back AFAICS. Not a big deal to reboot the VM in this case.
Olaf
Quoted 10 lines · Olaf Hering
Mon, 28 Oct 2024 02:06:20 -0700 Saurabh Singh Sengar <[email protected]>:
Quoted 3 lines
Thanks for the patch. Changes look good to me, I will suggest to improve this log message incase the error type is EIO by suggesting that users verify if 'Guest Services' is enabled.
No error happens if the state of "Guest services" remains unchanged during the life time of the VM (either "enabled" or "disabled"). Also no error happens if "Guest services" changes from "disabled" to "enabled". But the error happens if "Guest services" changes from "enabled" to "disabled".
All this is correct.
Quoted 6 lines
I think the actual
error "EIO" is not relevant for the commit message. Maybe you mean the second paragraph should read like this?This happens if the state of "Guest services" integration service is changed from "enabled" to "disabled" at runtime in the VM settings.
Right, we can inform user by putting this info in syslog error.
- Saurabh