aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxlflash
diff options
context:
space:
mode:
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>2015-10-21 16:11:26 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-10-30 04:01:07 -0400
commit2843fdbddd188edb4d7e60f72f513ad8b82d1a54 (patch)
treeb6fec4c84c8ed9a99897fa7bfc6397ff7ba48f2d /drivers/scsi/cxlflash
parent22fe1ae80fd14cb64be61d004b5e6c324bb6e984 (diff)
cxlflash: Fix data corruption when vLUN used over multiple cards
If the same virtual LUN is accessed over multiple cards, only accesses made over the first card will be valid. Accesses made over the second card will go to the wrong LUN causing data corruption. This is because the global LUN's mode word was being used to determine whether the LUN table for that card needs to be programmed. The mode word would be setup by the first card, causing the LUN table for the second card to not be programmed. By unconditionally initializing the LUN table (not depending on the mode word), the problem is avoided. Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Reviewed-by: Brian King <brking@linux.vnet.ibm.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/cxlflash')
-rw-r--r--drivers/scsi/cxlflash/vlun.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
index 68994c42c81f..96b074f701e8 100644
--- a/drivers/scsi/cxlflash/vlun.c
+++ b/drivers/scsi/cxlflash/vlun.c
@@ -915,16 +915,9 @@ int cxlflash_disk_virtual_open(struct scsi_device *sdev, void *arg)
915 915
916 pr_debug("%s: ctxid=%llu ls=0x%llx\n", __func__, ctxid, lun_size); 916 pr_debug("%s: ctxid=%llu ls=0x%llx\n", __func__, ctxid, lun_size);
917 917
918 /* Setup the LUNs block allocator on first call */
918 mutex_lock(&gli->mutex); 919 mutex_lock(&gli->mutex);
919 if (gli->mode == MODE_NONE) { 920 if (gli->mode == MODE_NONE) {
920 /* Setup the LUN table and block allocator on first call */
921 rc = init_luntable(cfg, lli);
922 if (rc) {
923 dev_err(dev, "%s: call to init_luntable failed "
924 "rc=%d!\n", __func__, rc);
925 goto err0;
926 }
927
928 rc = init_vlun(lli); 921 rc = init_vlun(lli);
929 if (rc) { 922 if (rc) {
930 dev_err(dev, "%s: call to init_vlun failed rc=%d!\n", 923 dev_err(dev, "%s: call to init_vlun failed rc=%d!\n",
@@ -942,6 +935,13 @@ int cxlflash_disk_virtual_open(struct scsi_device *sdev, void *arg)
942 } 935 }
943 mutex_unlock(&gli->mutex); 936 mutex_unlock(&gli->mutex);
944 937
938 rc = init_luntable(cfg, lli);
939 if (rc) {
940 dev_err(dev, "%s: call to init_luntable failed rc=%d!\n",
941 __func__, rc);
942 goto err1;
943 }
944
945 ctxi = get_context(cfg, rctxid, lli, 0); 945 ctxi = get_context(cfg, rctxid, lli, 0);
946 if (unlikely(!ctxi)) { 946 if (unlikely(!ctxi)) {
947 dev_err(dev, "%s: Bad context! (%llu)\n", __func__, ctxid); 947 dev_err(dev, "%s: Bad context! (%llu)\n", __func__, ctxid);