From 4a1af7f63c755c54db30b9cc47b2cb86608899ff Mon Sep 17 00:00:00 2001 From: Cathy Zhang Date: Tue, 24 Sep 2019 15:27:01 +0800 Subject: [PATCH] vhost-user-backend: Correct error handling in run The error handling here to trigger break epoll seems not correct, epoll will be ended once one event is handled, no matter successfully or failed. Fix it. Signed-off-by: Cathy Zhang --- vhost_user_backend/src/lib.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index d3d76af06..99c76ae8d 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -40,8 +40,6 @@ pub enum Error { WaitDaemon(std::boxed::Box), /// Failed handling a vhost-user request. HandleRequest(VhostUserError), - /// Failed to handle the event. - HandleEvent(io::Error), /// Failed to process queue. ProcessQueue(VringEpollHandlerError), /// Failed to register listener. @@ -439,13 +437,11 @@ impl VringWorker { let ev_type = event.data as u16; - if self - .handler - .write() - .unwrap() - .handle_event(ev_type, evset) - .map_err(VringWorkerError::HandleEvent)? - { + if let Err(e) = self.handler.write().unwrap().handle_event(ev_type, evset) { + println!( + "vring handler handle event {} with error {:?}\n", + ev_type, e + ); break 'epoll; } }