aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vhost/scsi.c')
-rw-r--r--drivers/vhost/scsi.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index cf50ce93975b..f1f284fe30fd 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1373,6 +1373,9 @@ err_dev:
1373 1373
1374static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) 1374static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
1375{ 1375{
1376 struct vhost_virtqueue *vq;
1377 int i;
1378
1376 if (features & ~VHOST_SCSI_FEATURES) 1379 if (features & ~VHOST_SCSI_FEATURES)
1377 return -EOPNOTSUPP; 1380 return -EOPNOTSUPP;
1378 1381
@@ -1382,9 +1385,13 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
1382 mutex_unlock(&vs->dev.mutex); 1385 mutex_unlock(&vs->dev.mutex);
1383 return -EFAULT; 1386 return -EFAULT;
1384 } 1387 }
1385 vs->dev.acked_features = features; 1388
1386 smp_wmb(); 1389 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
1387 vhost_scsi_flush(vs); 1390 vq = &vs->vqs[i].vq;
1391 mutex_lock(&vq->mutex);
1392 vq->acked_features = features;
1393 mutex_unlock(&vq->mutex);
1394 }
1388 mutex_unlock(&vs->dev.mutex); 1395 mutex_unlock(&vs->dev.mutex);
1389 return 0; 1396 return 0;
1390} 1397}
@@ -1591,10 +1598,6 @@ tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg,
1591 return; 1598 return;
1592 1599
1593 mutex_lock(&vs->dev.mutex); 1600 mutex_lock(&vs->dev.mutex);
1594 if (!vhost_has_feature(&vs->dev, VIRTIO_SCSI_F_HOTPLUG)) {
1595 mutex_unlock(&vs->dev.mutex);
1596 return;
1597 }
1598 1601
1599 if (plug) 1602 if (plug)
1600 reason = VIRTIO_SCSI_EVT_RESET_RESCAN; 1603 reason = VIRTIO_SCSI_EVT_RESET_RESCAN;
@@ -1603,8 +1606,9 @@ tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg,
1603 1606
1604 vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 1607 vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
1605 mutex_lock(&vq->mutex); 1608 mutex_lock(&vq->mutex);
1606 tcm_vhost_send_evt(vs, tpg, lun, 1609 if (vhost_has_feature(vq, VIRTIO_SCSI_F_HOTPLUG))
1607 VIRTIO_SCSI_T_TRANSPORT_RESET, reason); 1610 tcm_vhost_send_evt(vs, tpg, lun,
1611 VIRTIO_SCSI_T_TRANSPORT_RESET, reason);
1608 mutex_unlock(&vq->mutex); 1612 mutex_unlock(&vq->mutex);
1609 mutex_unlock(&vs->dev.mutex); 1613 mutex_unlock(&vs->dev.mutex);
1610} 1614}