aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-10-25 20:11:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-10-25 20:11:33 -0400
commit1c4e395cf7ded47f33084865cbe2357cdbe4fd07 (patch)
tree82c30f148a3fea9718d72fdfddab54edb9e9547f
parentb4b61b224d12ef12ff21cc598acce0ee818903ab (diff)
parent1052b41b25cbadcb85ff04c3b46663e21168dd3e (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Nine changes, eight to drivers (qla2xxx, hpsa, lpfc, alua, ch, 53c710[x2], target) and one core change that tries to close a race between sysfs delete and module removal" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: lpfc: remove left-over BUILD_NVME defines scsi: core: try to get module before removing device scsi: hpsa: add missing hunks in reset-patch scsi: target: core: Do not overwrite CDB byte 1 scsi: ch: Make it possible to open a ch device multiple times again scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE scsi: sni_53c710: fix compilation error scsi: scsi_dh_alua: handle RTPG sense code correctly during state transitions scsi: qla2xxx: fix a potential NULL pointer dereference
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/ch.c1
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c21
-rw-r--r--drivers/scsi/hpsa.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/scsi/scsi_sysfs.c11
-rw-r--r--drivers/scsi/sni_53c710.c4
-rw-r--r--drivers/target/target_core_device.c21
10 files changed, 36 insertions, 36 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 1b92f3c19ff3..90cf4691b8c3 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -898,7 +898,7 @@ config SCSI_SNI_53C710
898 898
899config 53C700_LE_ON_BE 899config 53C700_LE_ON_BE
900 bool 900 bool
901 depends on SCSI_LASI700 901 depends on SCSI_LASI700 || SCSI_SNI_53C710
902 default y 902 default y
903 903
904config SCSI_STEX 904config SCSI_STEX
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 5f8153c37f77..76751d6c7f0d 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -579,7 +579,6 @@ ch_release(struct inode *inode, struct file *file)
579 scsi_changer *ch = file->private_data; 579 scsi_changer *ch = file->private_data;
580 580
581 scsi_device_put(ch->device); 581 scsi_device_put(ch->device);
582 ch->device = NULL;
583 file->private_data = NULL; 582 file->private_data = NULL;
584 kref_put(&ch->ref, ch_destroy); 583 kref_put(&ch->ref, ch_destroy);
585 return 0; 584 return 0;
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 4971104b1817..f32da0ca529e 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -512,6 +512,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
512 unsigned int tpg_desc_tbl_off; 512 unsigned int tpg_desc_tbl_off;
513 unsigned char orig_transition_tmo; 513 unsigned char orig_transition_tmo;
514 unsigned long flags; 514 unsigned long flags;
515 bool transitioning_sense = false;
515 516
516 if (!pg->expiry) { 517 if (!pg->expiry) {
517 unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ; 518 unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ;
@@ -572,13 +573,19 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
572 goto retry; 573 goto retry;
573 } 574 }
574 /* 575 /*
575 * Retry on ALUA state transition or if any 576 * If the array returns with 'ALUA state transition'
576 * UNIT ATTENTION occurred. 577 * sense code here it cannot return RTPG data during
578 * transition. So set the state to 'transitioning' directly.
577 */ 579 */
578 if (sense_hdr.sense_key == NOT_READY && 580 if (sense_hdr.sense_key == NOT_READY &&
579 sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) 581 sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) {
580 err = SCSI_DH_RETRY; 582 transitioning_sense = true;
581 else if (sense_hdr.sense_key == UNIT_ATTENTION) 583 goto skip_rtpg;
584 }
585 /*
586 * Retry on any other UNIT ATTENTION occurred.
587 */
588 if (sense_hdr.sense_key == UNIT_ATTENTION)
582 err = SCSI_DH_RETRY; 589 err = SCSI_DH_RETRY;
583 if (err == SCSI_DH_RETRY && 590 if (err == SCSI_DH_RETRY &&
584 pg->expiry != 0 && time_before(jiffies, pg->expiry)) { 591 pg->expiry != 0 && time_before(jiffies, pg->expiry)) {
@@ -666,7 +673,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
666 off = 8 + (desc[7] * 4); 673 off = 8 + (desc[7] * 4);
667 } 674 }
668 675
676 skip_rtpg:
669 spin_lock_irqsave(&pg->lock, flags); 677 spin_lock_irqsave(&pg->lock, flags);
678 if (transitioning_sense)
679 pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
680
670 sdev_printk(KERN_INFO, sdev, 681 sdev_printk(KERN_INFO, sdev,
671 "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n", 682 "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n",
672 ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state), 683 ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ac39ed79ccaa..216e557f703e 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5477,6 +5477,8 @@ static int hpsa_ciss_submit(struct ctlr_info *h,
5477 return SCSI_MLQUEUE_HOST_BUSY; 5477 return SCSI_MLQUEUE_HOST_BUSY;
5478 } 5478 }
5479 5479
5480 c->device = dev;
5481
5480 enqueue_cmd_and_start_io(h, c); 5482 enqueue_cmd_and_start_io(h, c);
5481 /* the cmd'll come back via intr handler in complete_scsi_command() */ 5483 /* the cmd'll come back via intr handler in complete_scsi_command() */
5482 return 0; 5484 return 0;
@@ -5548,6 +5550,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
5548 hpsa_cmd_init(h, c->cmdindex, c); 5550 hpsa_cmd_init(h, c->cmdindex, c);
5549 c->cmd_type = CMD_SCSI; 5551 c->cmd_type = CMD_SCSI;
5550 c->scsi_cmd = cmd; 5552 c->scsi_cmd = cmd;
5553 c->device = dev;
5551 rc = hpsa_scsi_ioaccel_raid_map(h, c); 5554 rc = hpsa_scsi_ioaccel_raid_map(h, c);
5552 if (rc < 0) /* scsi_dma_map failed. */ 5555 if (rc < 0) /* scsi_dma_map failed. */
5553 rc = SCSI_MLQUEUE_HOST_BUSY; 5556 rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -5555,6 +5558,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
5555 hpsa_cmd_init(h, c->cmdindex, c); 5558 hpsa_cmd_init(h, c->cmdindex, c);
5556 c->cmd_type = CMD_SCSI; 5559 c->cmd_type = CMD_SCSI;
5557 c->scsi_cmd = cmd; 5560 c->scsi_cmd = cmd;
5561 c->device = dev;
5558 rc = hpsa_scsi_ioaccel_direct_map(h, c); 5562 rc = hpsa_scsi_ioaccel_direct_map(h, c);
5559 if (rc < 0) /* scsi_dma_map failed. */ 5563 if (rc < 0) /* scsi_dma_map failed. */
5560 rc = SCSI_MLQUEUE_HOST_BUSY; 5564 rc = SCSI_MLQUEUE_HOST_BUSY;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e91377a4cafe..e8813d26e594 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -9055,7 +9055,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba)
9055 } 9055 }
9056 } 9056 }
9057 9057
9058#if defined(BUILD_NVME)
9059 /* Clear NVME stats */ 9058 /* Clear NVME stats */
9060 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { 9059 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
9061 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { 9060 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) {
@@ -9063,7 +9062,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba)
9063 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); 9062 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat));
9064 } 9063 }
9065 } 9064 }
9066#endif
9067 9065
9068 /* Clear SCSI stats */ 9066 /* Clear SCSI stats */
9069 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { 9067 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) {
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index fe1097666de4..6822cd9ff8f1 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -528,7 +528,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba,
528 list_del_init(&psb->list); 528 list_del_init(&psb->list);
529 psb->exch_busy = 0; 529 psb->exch_busy = 0;
530 psb->status = IOSTAT_SUCCESS; 530 psb->status = IOSTAT_SUCCESS;
531#ifdef BUILD_NVME
532 if (psb->cur_iocbq.iocb_flag == LPFC_IO_NVME) { 531 if (psb->cur_iocbq.iocb_flag == LPFC_IO_NVME) {
533 qp->abts_nvme_io_bufs--; 532 qp->abts_nvme_io_bufs--;
534 spin_unlock(&qp->abts_io_buf_list_lock); 533 spin_unlock(&qp->abts_io_buf_list_lock);
@@ -536,7 +535,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba,
536 lpfc_sli4_nvme_xri_aborted(phba, axri, psb); 535 lpfc_sli4_nvme_xri_aborted(phba, axri, psb);
537 return; 536 return;
538 } 537 }
539#endif
540 qp->abts_scsi_io_bufs--; 538 qp->abts_scsi_io_bufs--;
541 spin_unlock(&qp->abts_io_buf_list_lock); 539 spin_unlock(&qp->abts_io_buf_list_lock);
542 540
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3568031c6504..bcb1e8598888 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3224,6 +3224,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3224 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); 3224 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
3225 3225
3226 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); 3226 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
3227 if (unlikely(!ha->wq)) {
3228 ret = -ENOMEM;
3229 goto probe_failed;
3230 }
3227 3231
3228 if (ha->isp_ops->initialize_adapter(base_vha)) { 3232 if (ha->isp_ops->initialize_adapter(base_vha)) {
3229 ql_log(ql_log_fatal, base_vha, 0x00d6, 3233 ql_log(ql_log_fatal, base_vha, 0x00d6,
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 64c96c7828ee..6d7362e7367e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -730,6 +730,14 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr,
730 const char *buf, size_t count) 730 const char *buf, size_t count)
731{ 731{
732 struct kernfs_node *kn; 732 struct kernfs_node *kn;
733 struct scsi_device *sdev = to_scsi_device(dev);
734
735 /*
736 * We need to try to get module, avoiding the module been removed
737 * during delete.
738 */
739 if (scsi_device_get(sdev))
740 return -ENODEV;
733 741
734 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); 742 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
735 WARN_ON_ONCE(!kn); 743 WARN_ON_ONCE(!kn);
@@ -744,9 +752,10 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr,
744 * state into SDEV_DEL. 752 * state into SDEV_DEL.
745 */ 753 */
746 device_remove_file(dev, attr); 754 device_remove_file(dev, attr);
747 scsi_remove_device(to_scsi_device(dev)); 755 scsi_remove_device(sdev);
748 if (kn) 756 if (kn)
749 sysfs_unbreak_active_protection(kn); 757 sysfs_unbreak_active_protection(kn);
758 scsi_device_put(sdev);
750 return count; 759 return count;
751}; 760};
752static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 761static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
index aef4881d8e21..a85d52b5dc32 100644
--- a/drivers/scsi/sni_53c710.c
+++ b/drivers/scsi/sni_53c710.c
@@ -66,10 +66,8 @@ static int snirm710_probe(struct platform_device *dev)
66 66
67 base = res->start; 67 base = res->start;
68 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); 68 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
69 if (!hostdata) { 69 if (!hostdata)
70 dev_printk(KERN_ERR, dev, "Failed to allocate host data\n");
71 return -ENOMEM; 70 return -ENOMEM;
72 }
73 71
74 hostdata->dev = &dev->dev; 72 hostdata->dev = &dev->dev;
75 dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); 73 dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 04bf2acd3800..2d19f0e332b0 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -1075,27 +1075,6 @@ passthrough_parse_cdb(struct se_cmd *cmd,
1075 unsigned int size; 1075 unsigned int size;
1076 1076
1077 /* 1077 /*
1078 * Clear a lun set in the cdb if the initiator talking to use spoke
1079 * and old standards version, as we can't assume the underlying device
1080 * won't choke up on it.
1081 */
1082 switch (cdb[0]) {
1083 case READ_10: /* SBC - RDProtect */
1084 case READ_12: /* SBC - RDProtect */
1085 case READ_16: /* SBC - RDProtect */
1086 case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */
1087 case VERIFY: /* SBC - VRProtect */
1088 case VERIFY_16: /* SBC - VRProtect */
1089 case WRITE_VERIFY: /* SBC - VRProtect */
1090 case WRITE_VERIFY_12: /* SBC - VRProtect */
1091 case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */
1092 break;
1093 default:
1094 cdb[1] &= 0x1f; /* clear logical unit number */
1095 break;
1096 }
1097
1098 /*
1099 * For REPORT LUNS we always need to emulate the response, for everything 1078 * For REPORT LUNS we always need to emulate the response, for everything
1100 * else, pass it up. 1079 * else, pass it up.
1101 */ 1080 */