diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-29 14:50:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-29 14:50:17 -0400 |
commit | 9c5891bd4342349a200676d33f742dd1b864822c (patch) | |
tree | b14c1698f2d8ce5276e1befd562f6398a46b48b9 /drivers/vhost/scsi.c | |
parent | ecda040ff3724f021a96491ecee88d48e968c153 (diff) | |
parent | 5ae90d8e467e625e447000cb4335c4db973b1095 (diff) |
Merge 3.11-rc3 into char-misc-next.
This resolves a merge issue with:
drivers/misc/mei/init.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vhost/scsi.c')
-rw-r--r-- | drivers/vhost/scsi.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 06adf31a9248..0c27c7df1b09 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -902,19 +902,15 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) | |||
902 | int head, ret; | 902 | int head, ret; |
903 | u8 target; | 903 | u8 target; |
904 | 904 | ||
905 | mutex_lock(&vq->mutex); | ||
905 | /* | 906 | /* |
906 | * We can handle the vq only after the endpoint is setup by calling the | 907 | * We can handle the vq only after the endpoint is setup by calling the |
907 | * VHOST_SCSI_SET_ENDPOINT ioctl. | 908 | * VHOST_SCSI_SET_ENDPOINT ioctl. |
908 | * | ||
909 | * TODO: Check that we are running from vhost_worker which acts | ||
910 | * as read-side critical section for vhost kind of RCU. | ||
911 | * See the comments in struct vhost_virtqueue in drivers/vhost/vhost.h | ||
912 | */ | 909 | */ |
913 | vs_tpg = rcu_dereference_check(vq->private_data, 1); | 910 | vs_tpg = vq->private_data; |
914 | if (!vs_tpg) | 911 | if (!vs_tpg) |
915 | return; | 912 | goto out; |
916 | 913 | ||
917 | mutex_lock(&vq->mutex); | ||
918 | vhost_disable_notify(&vs->dev, vq); | 914 | vhost_disable_notify(&vs->dev, vq); |
919 | 915 | ||
920 | for (;;) { | 916 | for (;;) { |
@@ -1064,6 +1060,7 @@ err_free: | |||
1064 | vhost_scsi_free_cmd(cmd); | 1060 | vhost_scsi_free_cmd(cmd); |
1065 | err_cmd: | 1061 | err_cmd: |
1066 | vhost_scsi_send_bad_target(vs, vq, head, out); | 1062 | vhost_scsi_send_bad_target(vs, vq, head, out); |
1063 | out: | ||
1067 | mutex_unlock(&vq->mutex); | 1064 | mutex_unlock(&vq->mutex); |
1068 | } | 1065 | } |
1069 | 1066 | ||
@@ -1232,9 +1229,8 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1232 | sizeof(vs->vs_vhost_wwpn)); | 1229 | sizeof(vs->vs_vhost_wwpn)); |
1233 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1230 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
1234 | vq = &vs->vqs[i].vq; | 1231 | vq = &vs->vqs[i].vq; |
1235 | /* Flushing the vhost_work acts as synchronize_rcu */ | ||
1236 | mutex_lock(&vq->mutex); | 1232 | mutex_lock(&vq->mutex); |
1237 | rcu_assign_pointer(vq->private_data, vs_tpg); | 1233 | vq->private_data = vs_tpg; |
1238 | vhost_init_used(vq); | 1234 | vhost_init_used(vq); |
1239 | mutex_unlock(&vq->mutex); | 1235 | mutex_unlock(&vq->mutex); |
1240 | } | 1236 | } |
@@ -1313,9 +1309,8 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1313 | if (match) { | 1309 | if (match) { |
1314 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1310 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
1315 | vq = &vs->vqs[i].vq; | 1311 | vq = &vs->vqs[i].vq; |
1316 | /* Flushing the vhost_work acts as synchronize_rcu */ | ||
1317 | mutex_lock(&vq->mutex); | 1312 | mutex_lock(&vq->mutex); |
1318 | rcu_assign_pointer(vq->private_data, NULL); | 1313 | vq->private_data = NULL; |
1319 | mutex_unlock(&vq->mutex); | 1314 | mutex_unlock(&vq->mutex); |
1320 | } | 1315 | } |
1321 | } | 1316 | } |