Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UBUNTU: SAUCE: hv/bounce buffer: Fix a race that can fail disk detection
As soon as hv_ringbuffer_write() returns, the host's response can arrive immediately, and the channel callback of hv_storvsc can be called -- at this time, if the "*pbounce_pkt" is still not assigned, the channel callback is unable to find the bounce_pkt info, and consequently storvsc_on_channel_callback() -> hv_pkt_bounce() is not called, i.e. the bounce buffer is leaked and we fail to copy the bounce buffer to the private SCSI response buffer, and from the VM's perspective it looks like the host didn't write the response, and the VM's SCSI commands (e.g. INQUERY, READ) may fail unexpectedly, and sometimes some of the disks can not be detected properly. Fix the race by moving the *pbounce_pkt line to before hv_ringbuffer_write(), and resetting it if hv_ringbuffer_write() fails. Fixes: df6c139 ("UBUNTU: SAUCE: x86/Hyper-V: Copy data from/to bounce buffer during IO operation.") Signed-off-by: Dexuan Cui <decui@microsoft.com>
- Loading branch information