diff --git a/virtio-devices/src/vhost_user/blk.rs b/virtio-devices/src/vhost_user/blk.rs index 06aa11f99..231af10e4 100644 --- a/virtio-devices/src/vhost_user/blk.rs +++ b/virtio-devices/src/vhost_user/blk.rs @@ -47,7 +47,7 @@ pub struct Blk { guest_memory: Option>, acked_protocol_features: u64, socket_path: String, - reconnect_epoll_thread: Option>, + epoll_thread: Option>, } impl Blk { @@ -143,7 +143,7 @@ impl Blk { guest_memory: None, acked_protocol_features, socket_path: vu_cfg.socket, - reconnect_epoll_thread: None, + epoll_thread: None, }) } } @@ -248,7 +248,7 @@ impl VirtioDevice for Blk { // the backend. let (kill_evt, pause_evt) = self.common.dup_eventfds(); - let mut reconnect_handler: VhostUserEpollHandler = VhostUserEpollHandler { + let mut handler: VhostUserEpollHandler = VhostUserEpollHandler { vu: self.vhost_user_blk.clone(), mem, kill_evt, @@ -270,11 +270,11 @@ impl VirtioDevice for Blk { thread::Builder::new() .name(self.id.to_string()) .spawn(move || { - if let Err(e) = reconnect_handler.run(paused, paused_sync.unwrap()) { - error!("Error running reconnection worker: {:?}", e); + if let Err(e) = handler.run(paused, paused_sync.unwrap()) { + error!("Error running vhost-user-blk worker: {:?}", e); } }) - .map(|thread| self.reconnect_epoll_thread = Some(thread)) + .map(|thread| self.epoll_thread = Some(thread)) .map_err(|e| { error!("failed to clone queue EventFd: {}", e); ActivateError::BadActivate @@ -340,8 +340,8 @@ impl Pausable for Blk { fn resume(&mut self) -> result::Result<(), MigratableError> { self.common.resume()?; - if let Some(reconnect_epoll_thread) = &self.reconnect_epoll_thread { - reconnect_epoll_thread.thread().unpark(); + if let Some(epoll_thread) = &self.epoll_thread { + epoll_thread.thread().unpark(); } Ok(()) } diff --git a/virtio-devices/src/vhost_user/fs.rs b/virtio-devices/src/vhost_user/fs.rs index 75f1a30eb..25d082d6c 100644 --- a/virtio-devices/src/vhost_user/fs.rs +++ b/virtio-devices/src/vhost_user/fs.rs @@ -282,7 +282,7 @@ pub struct Fs { guest_memory: Option>, acked_protocol_features: u64, socket_path: String, - reconnect_epoll_thread: Option>, + epoll_thread: Option>, } impl Fs { @@ -371,7 +371,7 @@ impl Fs { guest_memory: None, acked_protocol_features, socket_path: path.to_string(), - reconnect_epoll_thread: None, + epoll_thread: None, }) } } @@ -468,7 +468,7 @@ impl VirtioDevice for Fs { // Run a dedicated thread for handling potential reconnections with // the backend as well as requests initiated by the backend. let (kill_evt, pause_evt) = self.common.dup_eventfds(); - let mut reconnect_handler: VhostUserEpollHandler = VhostUserEpollHandler { + let mut handler: VhostUserEpollHandler = VhostUserEpollHandler { vu: self.vu.clone(), mem, kill_evt, @@ -496,11 +496,11 @@ impl VirtioDevice for Fs { .spawn(move || { if let Err(e) = SeccompFilter::apply(virtio_vhost_fs_seccomp_filter) { error!("Error applying seccomp filter: {:?}", e); - } else if let Err(e) = reconnect_handler.run(paused, paused_sync.unwrap()) { - error!("Error running reconnection worker: {:?}", e); + } else if let Err(e) = handler.run(paused, paused_sync.unwrap()) { + error!("Error running vhost-user-fs worker: {:?}", e); } }) - .map(|thread| self.reconnect_epoll_thread = Some(thread)) + .map(|thread| self.epoll_thread = Some(thread)) .map_err(|e| { error!("failed to clone queue EventFd: {}", e); ActivateError::BadActivate @@ -594,8 +594,8 @@ impl Pausable for Fs { fn resume(&mut self) -> result::Result<(), MigratableError> { self.common.resume()?; - if let Some(reconnect_epoll_thread) = &self.reconnect_epoll_thread { - reconnect_epoll_thread.thread().unpark(); + if let Some(epoll_thread) = &self.epoll_thread { + epoll_thread.thread().unpark(); } Ok(()) } diff --git a/virtio-devices/src/vhost_user/mod.rs b/virtio-devices/src/vhost_user/mod.rs index c2763b720..e41a7ff24 100644 --- a/virtio-devices/src/vhost_user/mod.rs +++ b/virtio-devices/src/vhost_user/mod.rs @@ -251,7 +251,7 @@ impl EpollHelperHandler for VhostUserEpollHandler< } } _ => { - error!("Unknown event for vhost-user reconnection thread"); + error!("Unknown event for vhost-user thread"); return true; } } diff --git a/virtio-devices/src/vhost_user/net.rs b/virtio-devices/src/vhost_user/net.rs index 109ca5967..2f269e3f9 100644 --- a/virtio-devices/src/vhost_user/net.rs +++ b/virtio-devices/src/vhost_user/net.rs @@ -101,7 +101,7 @@ pub struct Net { socket_path: String, server: bool, ctrl_queue_epoll_thread: Option>, - reconnect_epoll_thread: Option>, + epoll_thread: Option>, seccomp_action: SeccompAction, } @@ -193,7 +193,7 @@ impl Net { socket_path: vu_cfg.socket, server, ctrl_queue_epoll_thread: None, - reconnect_epoll_thread: None, + epoll_thread: None, seccomp_action, }) } @@ -258,9 +258,9 @@ impl VirtioDevice for Net { }; let paused = self.common.paused.clone(); - // Let's update the barrier as we need 1 for the control queue + 1 - // for the reconnect thread + 1 for the main thread signalling the - // pause. + // Let's update the barrier as we need 1 for the control queue + // thread + 1 for the common vhost-user thread + 1 for the main + // thread signalling the pause. self.common.paused_sync = Some(Arc::new(Barrier::new(3))); let paused_sync = self.common.paused_sync.clone(); @@ -317,7 +317,7 @@ impl VirtioDevice for Net { // the backend. let (kill_evt, pause_evt) = self.common.dup_eventfds(); - let mut reconnect_handler: VhostUserEpollHandler = VhostUserEpollHandler { + let mut handler: VhostUserEpollHandler = VhostUserEpollHandler { vu: self.vhost_user_net.clone(), mem, kill_evt, @@ -339,11 +339,11 @@ impl VirtioDevice for Net { thread::Builder::new() .name(self.id.to_string()) .spawn(move || { - if let Err(e) = reconnect_handler.run(paused, paused_sync.unwrap()) { - error!("Error running reconnection worker: {:?}", e); + if let Err(e) = handler.run(paused, paused_sync.unwrap()) { + error!("Error running vhost-user-net worker: {:?}", e); } }) - .map(|thread| self.reconnect_epoll_thread = Some(thread)) + .map(|thread| self.epoll_thread = Some(thread)) .map_err(|e| { error!("failed to clone queue EventFd: {}", e); ActivateError::BadActivate @@ -418,8 +418,8 @@ impl Pausable for Net { ctrl_queue_epoll_thread.thread().unpark(); } - if let Some(reconnect_epoll_thread) = &self.reconnect_epoll_thread { - reconnect_epoll_thread.thread().unpark(); + if let Some(epoll_thread) = &self.epoll_thread { + epoll_thread.thread().unpark(); } Ok(())