We don't need to run vhost_scsi_flush at the end of vhost_scsi_clear_endpoint, because a couple lines before this code if there are any tpgs in vs_tpg we take every vq mutex and clear the vq backend so know there will be no new IOs accessing the vs_tpg. And after we clear the backend we run vhost_scsi_flush already so we know there are no running cmds accessing the vs_tpg. Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> --- drivers/vhost/scsi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index c31659aa5466..502d64b53d9c 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1746,11 +1746,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, vhost_scsi_destroy_vq_cmds(vq); } } - /* - * Act as synchronize_rcu to make sure access to - * old vs->vs_tpg is finished. - */ - vhost_scsi_flush(vs); + kfree(vs->vs_tpg); vs->vs_tpg = NULL; WARN_ON(vs->vs_events_nr); -- 2.25.1