diff options
Diffstat (limited to 'drivers/vhost/tcm_vhost.c')
-rw-r--r-- | drivers/vhost/tcm_vhost.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 9951297b2427..43fb11ee2e8d 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
@@ -850,7 +850,7 @@ static int vhost_scsi_clear_endpoint( | |||
850 | for (index = 0; index < vs->dev.nvqs; ++index) { | 850 | for (index = 0; index < vs->dev.nvqs; ++index) { |
851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { | 851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { |
852 | ret = -EFAULT; | 852 | ret = -EFAULT; |
853 | goto err; | 853 | goto err_dev; |
854 | } | 854 | } |
855 | } | 855 | } |
856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { | 856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
@@ -860,10 +860,11 @@ static int vhost_scsi_clear_endpoint( | |||
860 | if (!tv_tpg) | 860 | if (!tv_tpg) |
861 | continue; | 861 | continue; |
862 | 862 | ||
863 | mutex_lock(&tv_tpg->tv_tpg_mutex); | ||
863 | tv_tport = tv_tpg->tport; | 864 | tv_tport = tv_tpg->tport; |
864 | if (!tv_tport) { | 865 | if (!tv_tport) { |
865 | ret = -ENODEV; | 866 | ret = -ENODEV; |
866 | goto err; | 867 | goto err_tpg; |
867 | } | 868 | } |
868 | 869 | ||
869 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 870 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
@@ -872,16 +873,19 @@ static int vhost_scsi_clear_endpoint( | |||
872 | tv_tport->tport_name, tv_tpg->tport_tpgt, | 873 | tv_tport->tport_name, tv_tpg->tport_tpgt, |
873 | t->vhost_wwpn, t->vhost_tpgt); | 874 | t->vhost_wwpn, t->vhost_tpgt); |
874 | ret = -EINVAL; | 875 | ret = -EINVAL; |
875 | goto err; | 876 | goto err_tpg; |
876 | } | 877 | } |
877 | tv_tpg->tv_tpg_vhost_count--; | 878 | tv_tpg->tv_tpg_vhost_count--; |
878 | vs->vs_tpg[target] = NULL; | 879 | vs->vs_tpg[target] = NULL; |
879 | vs->vs_endpoint = false; | 880 | vs->vs_endpoint = false; |
881 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
880 | } | 882 | } |
881 | mutex_unlock(&vs->dev.mutex); | 883 | mutex_unlock(&vs->dev.mutex); |
882 | return 0; | 884 | return 0; |
883 | 885 | ||
884 | err: | 886 | err_tpg: |
887 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
888 | err_dev: | ||
885 | mutex_unlock(&vs->dev.mutex); | 889 | mutex_unlock(&vs->dev.mutex); |
886 | return ret; | 890 | return ret; |
887 | } | 891 | } |
@@ -937,6 +941,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) | |||
937 | 941 | ||
938 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | 942 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) |
939 | vhost_scsi_flush_vq(vs, i); | 943 | vhost_scsi_flush_vq(vs, i); |
944 | vhost_work_flush(&vs->dev, &vs->vs_completion_work); | ||
940 | } | 945 | } |
941 | 946 | ||
942 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | 947 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) |