aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-03-23 19:51:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-03-23 19:51:55 -0400
commita607a1143a58dcd31396649812df5cd3bb0d4294 (patch)
tree1468ffca95ce7b3048d671568ae43580de1fcaa4 /drivers/vhost
parent22c3f2fff68abf1ccf88e1a72f61bfede7b91da0 (diff)
parent8f27d487bcc2bd603c2d87e1729abcbc301f15db (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target fixes from Nicholas Bellinger: "These are mostly minor fixes this time around. The iscsi-target CHAP big-endian bugfix and bump FD_MAX_SECTORS=2048 default patch to allow 1MB sized I/Os for FILEIO backends on >= v3.5 code are both CC'ed to stable. Also, there is a persistent reservations regression that has recently been reported for >= v3.8.x code, that is currently being tracked down for v3.9." * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: target/pscsi: Reject cross page boundary case in pscsi_map_sg target/file: Bump FD_MAX_SECTORS to 2048 to handle 1M sized I/Os tcm_vhost: Flush vhost_work in vhost_scsi_flush() tcm_vhost: Add missed lock in vhost_scsi_clear_endpoint() target: fix possible memory leak in core_tpg_register() target/iscsi: Fix mutual CHAP auth on big-endian arches target_core_sbc: use noop for SYNCHRONIZE_CACHE
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/tcm_vhost.c13
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
884err: 886err_tpg:
887 mutex_unlock(&tv_tpg->tv_tpg_mutex);
888err_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
942static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) 947static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)