scsi.c (e7802212ea4bbbd5db99181942a19ab36ca4b914) | scsi.c (22fa90c7fb479694d6affebc049d21f06b714be6) |
---|---|
1/******************************************************************************* 2 * Vhost kernel TCM fabric driver for virtio SCSI initiators 3 * 4 * (C) Copyright 2010-2012 RisingTide Systems LLC. 5 * (C) Copyright 2010-2012 IBM Corp. 6 * 7 * Licensed to the Linux Foundation under the General Public License (GPL) version 2. 8 * --- 1209 unchanged lines hidden (view full) --- 1218 mutex_unlock(&tpg->tv_tpg_mutex); 1219 } 1220 1221 if (match) { 1222 memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn, 1223 sizeof(vs->vs_vhost_wwpn)); 1224 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { 1225 vq = &vs->vqs[i].vq; | 1/******************************************************************************* 2 * Vhost kernel TCM fabric driver for virtio SCSI initiators 3 * 4 * (C) Copyright 2010-2012 RisingTide Systems LLC. 5 * (C) Copyright 2010-2012 IBM Corp. 6 * 7 * Licensed to the Linux Foundation under the General Public License (GPL) version 2. 8 * --- 1209 unchanged lines hidden (view full) --- 1218 mutex_unlock(&tpg->tv_tpg_mutex); 1219 } 1220 1221 if (match) { 1222 memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn, 1223 sizeof(vs->vs_vhost_wwpn)); 1224 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { 1225 vq = &vs->vqs[i].vq; |
1226 /* Flushing the vhost_work acts as synchronize_rcu */ | |
1227 mutex_lock(&vq->mutex); | 1226 mutex_lock(&vq->mutex); |
1228 rcu_assign_pointer(vq->private_data, vs_tpg); | 1227 vq->private_data = vs_tpg; |
1229 vhost_init_used(vq); 1230 mutex_unlock(&vq->mutex); 1231 } 1232 ret = 0; 1233 } else { 1234 ret = -EEXIST; 1235 } 1236 --- 62 unchanged lines hidden (view full) --- 1299 tpg->vhost_scsi = NULL; 1300 vs->vs_tpg[target] = NULL; 1301 match = true; 1302 mutex_unlock(&tpg->tv_tpg_mutex); 1303 } 1304 if (match) { 1305 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { 1306 vq = &vs->vqs[i].vq; | 1228 vhost_init_used(vq); 1229 mutex_unlock(&vq->mutex); 1230 } 1231 ret = 0; 1232 } else { 1233 ret = -EEXIST; 1234 } 1235 --- 62 unchanged lines hidden (view full) --- 1298 tpg->vhost_scsi = NULL; 1299 vs->vs_tpg[target] = NULL; 1300 match = true; 1301 mutex_unlock(&tpg->tv_tpg_mutex); 1302 } 1303 if (match) { 1304 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { 1305 vq = &vs->vqs[i].vq; |
1307 /* Flushing the vhost_work acts as synchronize_rcu */ | |
1308 mutex_lock(&vq->mutex); | 1306 mutex_lock(&vq->mutex); |
1309 rcu_assign_pointer(vq->private_data, NULL); | 1307 vq->private_data = NULL; |
1310 mutex_unlock(&vq->mutex); 1311 } 1312 } 1313 /* 1314 * Act as synchronize_rcu to make sure access to 1315 * old vs->vs_tpg is finished. 1316 */ 1317 vhost_scsi_flush(vs); --- 837 unchanged lines hidden --- | 1308 mutex_unlock(&vq->mutex); 1309 } 1310 } 1311 /* 1312 * Act as synchronize_rcu to make sure access to 1313 * old vs->vs_tpg is finished. 1314 */ 1315 vhost_scsi_flush(vs); --- 837 unchanged lines hidden --- |