From 80c9dc2e0c5cfac8afdf1ffa174f0374f27fe355 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 6 Feb 2020 10:47:43 +0000 Subject: [PATCH] Revert "vhost-user-backend: Correct error handling in run" This reverts commit 4a1af7f63c755c54db30b9cc47b2cb86608899ff. This change erroneously ignored the return value for the result which meant that requests to break out of the loop due to a kill event were lost. Signed-off-by: Rob Bradford --- vhost_user_backend/src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index f9f96ba37..8a266ddaf 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -262,6 +262,8 @@ impl VringEpollHandler { enum VringWorkerError { /// Failed while waiting for events. EpollWait(io::Error), + /// Failed to handle the event. + HandleEvent(VringEpollHandlerError), } /// Result of vring worker operations. @@ -306,11 +308,10 @@ impl VringWorker { let ev_type = event.data as u16; - if let Err(e) = handler.handle_event(ev_type, evset) { - println!( - "vring handler handle event {} with error {:?}\n", - ev_type, e - ); + if handler + .handle_event(ev_type, evset) + .map_err(VringWorkerError::HandleEvent)? + { break 'epoll; } }