WSL2-Linux-Kernel/tools/hv
Dexuan Cui 9fc3c01a1f Tools: hv: Reopen the devices if read() or write() returns errors
The state machine in the hv_utils driver can run out of order in some
corner cases, e.g. if the kvp daemon doesn't call write() fast enough
due to some reason, kvp_timeout_func() can run first and move the state
to HVUTIL_READY; next, when kvp_on_msg() is called it returns -EINVAL
since kvp_transaction.state is smaller than HVUTIL_USERSPACE_REQ; later,
the daemon's write() gets an error -EINVAL, and the daemon will exit().

We can reproduce the issue by sending a SIGSTOP signal to the daemon, wait
for 1 minute, and send a SIGCONT signal to the daemon: the daemon will
exit() quickly.

We can fix the issue by forcing a reset of the device (which means the
daemon can close() and open() the device again) and doing extra necessary
clean-up.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-26 22:10:10 -05:00
..
Build Tools: hv: move to tools buildsystem 2019-08-20 11:31:45 -04:00
Makefile Tools: hv: move to tools buildsystem 2019-08-20 11:31:45 -04:00
hv_fcopy_daemon.c Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
hv_get_dhcp_info.sh tools: hv: fix typos in toolchain 2019-08-17 15:29:28 -04:00
hv_get_dns_info.sh
hv_kvp_daemon.c Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
hv_set_ifconfig.sh tools: hv: fix typos in toolchain 2019-08-17 15:29:28 -04:00
hv_vss_daemon.c Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
lsvmbus tools: hv: fixed Python pep8/flake8 warnings for lsvmbus 2019-08-17 15:29:18 -04:00
vmbus_testing tools: hv: add vmbus testing tool 2019-11-21 20:10:44 -05:00