From fa282f6cb948e31e63c6f67f70179fe0816d0113 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Tue, 30 Jul 2019 11:48:10 +0200 Subject: [PATCH] vhost/scsi: don't clear svdev->poll_group Don't unset svdev->poll_group when the last session is stopped, just keep the old reference in there. When a session is started, a new poll group will be picked and svdev->poll_group will get overwritten anyway. This is just a cleanup that aligns the code for making vhost_session_send_event() asynchronous. Change-Id: Ibf145603fd7525a65c4304b0bb1828dcbe2b52cf Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467227 Tested-by: SPDK CI Jenkins Reviewed-by: Vitaliy Mysak Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- lib/vhost/vhost_scsi.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index f23104736..155b284fa 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -1359,7 +1359,6 @@ vhost_scsi_start(struct spdk_vhost_session *vsession) { struct spdk_vhost_scsi_session *svsession = to_scsi_session(vsession); struct spdk_vhost_scsi_dev *svdev; - int rc; svdev = to_scsi_dev(vsession->vdev); assert(svdev != NULL); @@ -1369,15 +1368,8 @@ vhost_scsi_start(struct spdk_vhost_session *vsession) svdev->poll_group = vhost_get_poll_group(svdev->vdev.cpumask); } - rc = vhost_session_send_event(svdev->poll_group, vsession, vhost_scsi_start_cb, - 3, "start session"); - if (rc != 0) { - if (svdev->vdev.active_session_num == 0) { - svdev->poll_group = NULL; - } - } - - return rc; + return vhost_session_send_event(svdev->poll_group, vsession, + vhost_scsi_start_cb, 3, "start session"); } static int @@ -1463,19 +1455,8 @@ vhost_scsi_stop_cb(struct spdk_vhost_dev *vdev, static int vhost_scsi_stop(struct spdk_vhost_session *vsession) { - struct spdk_vhost_scsi_session *svsession = to_scsi_session(vsession); - int rc; - - rc = vhost_session_send_event(vsession->poll_group, vsession, - vhost_scsi_stop_cb, 3, "stop session"); - if (rc != 0) { - return rc; - } - - if (vsession->vdev->active_session_num == 0) { - svsession->svdev->poll_group = NULL; - } - return 0; + return vhost_session_send_event(vsession->poll_group, vsession, + vhost_scsi_stop_cb, 3, "stop session"); } static void