devices: virtio: Update fs code to use sync::Mutex
fs/worker.rs and fs/mod.rs were still using the old std::sync::Mutex
version instead of the crosvm-specific wrapper sync::Mutex
BUG=b:179636297
TEST=build crosvm and run shared-dir with virtio-fs
Change-Id: I773a885fd0ef35e25bc7a090f067d8a6f60636da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3058837
Auto-Submit: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
diff --git a/devices/src/virtio/fs/mod.rs b/devices/src/virtio/fs/mod.rs
index bc8c28f..4cf916a 100644
--- a/devices/src/virtio/fs/mod.rs
+++ b/devices/src/virtio/fs/mod.rs
@@ -5,12 +5,13 @@
use std::fmt;
use std::io;
use std::mem;
-use std::sync::{Arc, Mutex};
+use std::sync::Arc;
use std::thread;
use base::{error, warn, AsRawDescriptor, Error as SysError, Event, RawDescriptor, Tube};
use data_model::{DataInit, Le32};
use resources::Alloc;
+use sync::Mutex;
use vm_control::{FsMappingRequest, VmResponse};
use vm_memory::GuestMemory;
diff --git a/devices/src/virtio/fs/worker.rs b/devices/src/virtio/fs/worker.rs
index 2bc6152..55049b8 100644
--- a/devices/src/virtio/fs/worker.rs
+++ b/devices/src/virtio/fs/worker.rs
@@ -6,10 +6,11 @@
use std::fs::File;
use std::io;
use std::os::unix::io::AsRawFd;
-use std::sync::{Arc, Mutex};
+use std::sync::Arc;
use base::{error, Event, PollToken, SafeDescriptor, Tube, WaitContext};
use fuse::filesystem::{FileSystem, ZeroCopyReader, ZeroCopyWriter};
+use sync::Mutex;
use vm_control::{FsMappingRequest, VmResponse};
use vm_memory::GuestMemory;
@@ -55,10 +56,7 @@
}
fn process_request(&self, request: &FsMappingRequest) -> io::Result<()> {
- let tube = self.tube.lock().map_err(|e| {
- error!("failed to lock tube: {}", e);
- io::Error::from_raw_os_error(libc::EINVAL)
- })?;
+ let tube = self.tube.lock();
tube.send(request).map_err(|e| {
error!("failed to send request {:?}: {}", request, e);