From ae19c072e84f2093175f9b8d205ea5092419cedf Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Tue, 3 Oct 2017 09:05:10 +0200 Subject: [PATCH] vhost: don't abort on event timeout A single timeout error message is printed on the screen already, so the user knows about the timeout. Instead of aborting the app here, wait endlessly for the event to complete. User can kill the app any time if he wants to. Change-Id: Ie1853e27b277d654a8e1099866d120f7a51638ba Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/381075 Tested-by: SPDK Automated Test System Reviewed-by: Pawel Wodkowski Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/vhost/vhost.c | 4 ++-- lib/vhost/vhost_internal.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index fb89a8e92..5b9672932 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -637,8 +637,8 @@ spdk_vhost_event_send(struct spdk_vhost_dev *vdev, spdk_vhost_event_fn cb_fn, rc = sem_timedwait(&ev_ctx.sem, &timeout); if (rc != 0) { - SPDK_ERRLOG("Timout waiting for event: %s.\n", errmsg); - abort(); + SPDK_ERRLOG("Timeout waiting for event: %s.\n", errmsg); + sem_wait(&ev_ctx.sem); } sem_destroy(&ev_ctx.sem); diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 111b98c77..cffb8f597 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -91,9 +91,6 @@ struct spdk_vhost_dev_backend { * The first param is struct spdk_vhost_dev *. * The second one is event context that has to be * passed to spdk_vhost_dev_backend_event_done(). - * If spdk_vhost_dev_backend_event_done isn't called - * within an arbitrary limit of 3 seconds, these - * callbacks will time out. */ spdk_vhost_event_fn start_device; spdk_vhost_event_fn stop_device;