summaryrefslogtreecommitdiff
path: root/src/vhost_user
diff options
context:
space:
mode:
authorSebastien Boeuf <sebastien.boeuf@intel.com>2019-08-28 19:02:10 -0700
committerAndreea Florescu <andreea.florescu15@gmail.com>2020-09-04 17:59:53 +0300
commit37414831aadde3c8d72f04c17da2f40aa2fbc2b1 (patch)
tree85c7472df0f2da14e8d40131ad78c0adcf966916 /src/vhost_user
parente2d4c8686bc3d50aeb16764324e05eab6ec93514 (diff)
downloadvmm_vhost-37414831aadde3c8d72f04c17da2f40aa2fbc2b1.tar.gz
vhost-user: Wait for full request to be satisfied
The recvmsg syscall can split a request in multiple packets unless we use the flag MSG_WAITALL to make sure the request will wait for the whole data to be transferred before returning. This flag is needed to prevent the vhost crate from returning the error PartialMessage, which occured sporadically when using virtio-fs, and which was detected as part of our continuous integration testing. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Diffstat (limited to 'src/vhost_user')
-rw-r--r--src/vhost_user/sock_ctrl_msg.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vhost_user/sock_ctrl_msg.rs b/src/vhost_user/sock_ctrl_msg.rs
index be9ba32..76d760f 100644
--- a/src/vhost_user/sock_ctrl_msg.rs
+++ b/src/vhost_user/sock_ctrl_msg.rs
@@ -176,7 +176,7 @@ fn raw_recvmsg(fd: RawFd, iovecs: &mut [iovec], in_fds: &mut [RawFd]) -> Result<
// Safe because the msghdr was properly constructed from valid (or null) pointers of the
// indicated length and we check the return value.
- let total_read = unsafe { recvmsg(fd, &mut msg, 0) };
+ let total_read = unsafe { recvmsg(fd, &mut msg, libc::MSG_WAITALL) };
if total_read == -1 {
return Err(Error::last());