Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"This is a set of 12 fixes including the mpt3sas one that was causing
hangs on ATA passthrough.

The others are a couple of zoned block device fixes, a SAS device
detection bug which lead to SATA drives not being matched to bays, two
qla2xxx MSI fixes, a qla2xxx req for rsp confusion caused by cut and
paste, and a few other minor fixes"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: mpt3sas: fix hang on ata passthrough commands
scsi: lpfc: Set elsiocb contexts to NULL after freeing it
scsi: sd: Ignore zoned field for host-managed devices
scsi: sd: Fix wrong DPOFUA disable in sd_read_cache_type
scsi: bfa: fix wrongly initialized variable in bfad_im_bsg_els_ct_request()
scsi: ses: Fix SAS device detection in enclosure
scsi: libfc: Fix variable name in fc_set_wwpn
scsi: lpfc: avoid double free of resource identifiers
scsi: qla2xxx: remove irq_affinity_notifier
scsi: qla2xxx: fix MSI-X vector affinity
scsi: qla2xxx: Fix apparent cut-n-paste error.
scsi: qla2xxx: Get mutex lock before checking optrom_state

+95 -112
+1 -1
drivers/scsi/bfa/bfad_bsg.c
··· 3363 3363 struct bfad_fcxp *drv_fcxp; 3364 3364 struct bfa_fcs_lport_s *fcs_port; 3365 3365 struct bfa_fcs_rport_s *fcs_rport; 3366 - struct fc_bsg_request *bsg_request = bsg_request; 3366 + struct fc_bsg_request *bsg_request = job->request; 3367 3367 struct fc_bsg_reply *bsg_reply = job->reply; 3368 3368 uint32_t command_type = bsg_request->msgcode; 3369 3369 unsigned long flags;
+2
drivers/scsi/lpfc/lpfc_els.c
··· 3590 3590 } else { 3591 3591 buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2; 3592 3592 lpfc_els_free_data(phba, buf_ptr1); 3593 + elsiocb->context2 = NULL; 3593 3594 } 3594 3595 } 3595 3596 3596 3597 if (elsiocb->context3) { 3597 3598 buf_ptr = (struct lpfc_dmabuf *) elsiocb->context3; 3598 3599 lpfc_els_free_bpl(phba, buf_ptr); 3600 + elsiocb->context3 = NULL; 3599 3601 } 3600 3602 lpfc_sli_release_iocbq(phba, elsiocb); 3601 3603 return 0;
+7
drivers/scsi/lpfc/lpfc_sli.c
··· 5954 5954 5955 5955 free_vfi_bmask: 5956 5956 kfree(phba->sli4_hba.vfi_bmask); 5957 + phba->sli4_hba.vfi_bmask = NULL; 5957 5958 free_xri_ids: 5958 5959 kfree(phba->sli4_hba.xri_ids); 5960 + phba->sli4_hba.xri_ids = NULL; 5959 5961 free_xri_bmask: 5960 5962 kfree(phba->sli4_hba.xri_bmask); 5963 + phba->sli4_hba.xri_bmask = NULL; 5961 5964 free_vpi_ids: 5962 5965 kfree(phba->vpi_ids); 5966 + phba->vpi_ids = NULL; 5963 5967 free_vpi_bmask: 5964 5968 kfree(phba->vpi_bmask); 5969 + phba->vpi_bmask = NULL; 5965 5970 free_rpi_ids: 5966 5971 kfree(phba->sli4_hba.rpi_ids); 5972 + phba->sli4_hba.rpi_ids = NULL; 5967 5973 free_rpi_bmask: 5968 5974 kfree(phba->sli4_hba.rpi_bmask); 5975 + phba->sli4_hba.rpi_bmask = NULL; 5969 5976 err_exit: 5970 5977 return rc; 5971 5978 }
+12
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 393 393 * @eedp_enable: eedp support enable bit 394 394 * @eedp_type: 0(type_1), 1(type_2), 2(type_3) 395 395 * @eedp_block_length: block size 396 + * @ata_command_pending: SATL passthrough outstanding for device 396 397 */ 397 398 struct MPT3SAS_DEVICE { 398 399 struct MPT3SAS_TARGET *sas_target; ··· 405 404 u8 ignore_delay_remove; 406 405 /* Iopriority Command Handling */ 407 406 u8 ncq_prio_enable; 407 + /* 408 + * Bug workaround for SATL handling: the mpt2/3sas firmware 409 + * doesn't return BUSY or TASK_SET_FULL for subsequent 410 + * commands while a SATL pass through is in operation as the 411 + * spec requires, it simply does nothing with them until the 412 + * pass through completes, causing them possibly to timeout if 413 + * the passthrough is a long executing command (like format or 414 + * secure erase). This variable allows us to do the right 415 + * thing while a SATL command is pending. 416 + */ 417 + unsigned long ata_command_pending; 408 418 409 419 }; 410 420
+26 -14
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 3899 3899 } 3900 3900 } 3901 3901 3902 - static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) 3902 + static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending) 3903 3903 { 3904 - return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); 3904 + struct MPT3SAS_DEVICE *priv = scmd->device->hostdata; 3905 + 3906 + if (scmd->cmnd[0] != ATA_12 && scmd->cmnd[0] != ATA_16) 3907 + return 0; 3908 + 3909 + if (pending) 3910 + return test_and_set_bit(0, &priv->ata_command_pending); 3911 + 3912 + clear_bit(0, &priv->ata_command_pending); 3913 + return 0; 3905 3914 } 3906 3915 3907 3916 /** ··· 3934 3925 if (!scmd) 3935 3926 continue; 3936 3927 count++; 3937 - if (ata_12_16_cmd(scmd)) 3938 - scsi_internal_device_unblock(scmd->device, 3939 - SDEV_RUNNING); 3928 + _scsih_set_satl_pending(scmd, false); 3940 3929 mpt3sas_base_free_smid(ioc, smid); 3941 3930 scsi_dma_unmap(scmd); 3942 3931 if (ioc->pci_error_recovery) ··· 4070 4063 if (ioc->logging_level & MPT_DEBUG_SCSI) 4071 4064 scsi_print_command(scmd); 4072 4065 4073 - /* 4074 - * Lock the device for any subsequent command until command is 4075 - * done. 4076 - */ 4077 - if (ata_12_16_cmd(scmd)) 4078 - scsi_internal_device_block(scmd->device); 4079 - 4080 4066 sas_device_priv_data = scmd->device->hostdata; 4081 4067 if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { 4082 4068 scmd->result = DID_NO_CONNECT << 16; ··· 4082 4082 scmd->scsi_done(scmd); 4083 4083 return 0; 4084 4084 } 4085 + 4086 + /* 4087 + * Bug work around for firmware SATL handling. The loop 4088 + * is based on atomic operations and ensures consistency 4089 + * since we're lockless at this point 4090 + */ 4091 + do { 4092 + if (test_bit(0, &sas_device_priv_data->ata_command_pending)) { 4093 + scmd->result = SAM_STAT_BUSY; 4094 + scmd->scsi_done(scmd); 4095 + return 0; 4096 + } 4097 + } while (_scsih_set_satl_pending(scmd, true)); 4085 4098 4086 4099 sas_target_priv_data = sas_device_priv_data->sas_target; 4087 4100 ··· 4663 4650 if (scmd == NULL) 4664 4651 return 1; 4665 4652 4666 - if (ata_12_16_cmd(scmd)) 4667 - scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); 4653 + _scsih_set_satl_pending(scmd, false); 4668 4654 4669 4655 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); 4670 4656
+14 -6
drivers/scsi/qla2xxx/qla_attr.c
··· 243 243 struct qla_hw_data *ha = vha->hw; 244 244 ssize_t rval = 0; 245 245 246 - if (ha->optrom_state != QLA_SREADING) 247 - return 0; 248 - 249 246 mutex_lock(&ha->optrom_mutex); 247 + 248 + if (ha->optrom_state != QLA_SREADING) 249 + goto out; 250 + 250 251 rval = memory_read_from_buffer(buf, count, &off, ha->optrom_buffer, 251 252 ha->optrom_region_size); 253 + 254 + out: 252 255 mutex_unlock(&ha->optrom_mutex); 253 256 254 257 return rval; ··· 266 263 struct device, kobj))); 267 264 struct qla_hw_data *ha = vha->hw; 268 265 269 - if (ha->optrom_state != QLA_SWRITING) 266 + mutex_lock(&ha->optrom_mutex); 267 + 268 + if (ha->optrom_state != QLA_SWRITING) { 269 + mutex_unlock(&ha->optrom_mutex); 270 270 return -EINVAL; 271 - if (off > ha->optrom_region_size) 271 + } 272 + if (off > ha->optrom_region_size) { 273 + mutex_unlock(&ha->optrom_mutex); 272 274 return -ERANGE; 275 + } 273 276 if (off + count > ha->optrom_region_size) 274 277 count = ha->optrom_region_size - off; 275 278 276 - mutex_lock(&ha->optrom_mutex); 277 279 memcpy(&ha->optrom_buffer[off], buf, count); 278 280 mutex_unlock(&ha->optrom_mutex); 279 281
+1 -2
drivers/scsi/qla2xxx/qla_def.h
··· 2732 2732 #define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7) 2733 2733 #define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1) 2734 2734 2735 - #define QLA_MSIX_DEFAULT 0x00 2735 + #define QLA_BASE_VECTORS 2 /* default + RSP */ 2736 2736 #define QLA_MSIX_RSP_Q 0x01 2737 2737 #define QLA_ATIO_VECTOR 0x02 2738 2738 #define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03 ··· 2754 2754 uint16_t entry; 2755 2755 char name[30]; 2756 2756 void *handle; 2757 - struct irq_affinity_notify irq_notify; 2758 2757 int cpuid; 2759 2758 }; 2760 2759
+11 -77
drivers/scsi/qla2xxx/qla_isr.c
··· 19 19 static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *); 20 20 static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, 21 21 sts_entry_t *); 22 - static void qla_irq_affinity_notify(struct irq_affinity_notify *, 23 - const cpumask_t *); 24 - static void qla_irq_affinity_release(struct kref *); 25 - 26 22 27 23 /** 28 24 * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. ··· 2568 2572 if (!vha->flags.online) 2569 2573 return; 2570 2574 2571 - if (rsp->msix && rsp->msix->cpuid != smp_processor_id()) { 2572 - /* if kernel does not notify qla of IRQ's CPU change, 2573 - * then set it here. 2574 - */ 2575 - rsp->msix->cpuid = smp_processor_id(); 2576 - ha->tgt.rspq_vector_cpuid = rsp->msix->cpuid; 2577 - } 2578 - 2579 2575 while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { 2580 2576 pkt = (struct sts_entry_24xx *)rsp->ring_ptr; 2581 2577 ··· 3006 3018 static int 3007 3019 qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) 3008 3020 { 3009 - #define MIN_MSIX_COUNT 2 3010 3021 int i, ret; 3011 3022 struct qla_msix_entry *qentry; 3012 3023 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 3024 + struct irq_affinity desc = { 3025 + .pre_vectors = QLA_BASE_VECTORS, 3026 + }; 3013 3027 3014 - ret = pci_alloc_irq_vectors(ha->pdev, MIN_MSIX_COUNT, ha->msix_count, 3015 - PCI_IRQ_MSIX | PCI_IRQ_AFFINITY); 3028 + if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) 3029 + desc.pre_vectors++; 3030 + 3031 + ret = pci_alloc_irq_vectors_affinity(ha->pdev, QLA_BASE_VECTORS, 3032 + ha->msix_count, PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, 3033 + &desc); 3034 + 3016 3035 if (ret < 0) { 3017 3036 ql_log(ql_log_fatal, vha, 0x00c7, 3018 3037 "MSI-X: Failed to enable support, " ··· 3064 3069 qentry->have_irq = 0; 3065 3070 qentry->in_use = 0; 3066 3071 qentry->handle = NULL; 3067 - qentry->irq_notify.notify = qla_irq_affinity_notify; 3068 - qentry->irq_notify.release = qla_irq_affinity_release; 3069 - qentry->cpuid = -1; 3070 3072 } 3071 3073 3072 3074 /* Enable MSI-X vectors for the base queue */ 3073 - for (i = 0; i < (QLA_MSIX_RSP_Q + 1); i++) { 3075 + for (i = 0; i < QLA_BASE_VECTORS; i++) { 3074 3076 qentry = &ha->msix_entries[i]; 3075 3077 qentry->handle = rsp; 3076 3078 rsp->msix = qentry; ··· 3085 3093 goto msix_register_fail; 3086 3094 qentry->have_irq = 1; 3087 3095 qentry->in_use = 1; 3088 - 3089 - /* Register for CPU affinity notification. */ 3090 - irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify); 3091 - 3092 - /* Schedule work (ie. trigger a notification) to read cpu 3093 - * mask for this specific irq. 3094 - * kref_get is required because 3095 - * irq_affinity_notify() will do 3096 - * kref_put(). 3097 - */ 3098 - kref_get(&qentry->irq_notify.kref); 3099 - schedule_work(&qentry->irq_notify.work); 3100 3096 } 3101 3097 3102 3098 /* ··· 3280 3300 msix->have_irq = 1; 3281 3301 msix->handle = qpair; 3282 3302 return ret; 3283 - } 3284 - 3285 - 3286 - /* irq_set_affinity/irqbalance will trigger notification of cpu mask update */ 3287 - static void qla_irq_affinity_notify(struct irq_affinity_notify *notify, 3288 - const cpumask_t *mask) 3289 - { 3290 - struct qla_msix_entry *e = 3291 - container_of(notify, struct qla_msix_entry, irq_notify); 3292 - struct qla_hw_data *ha; 3293 - struct scsi_qla_host *base_vha; 3294 - struct rsp_que *rsp = e->handle; 3295 - 3296 - /* user is recommended to set mask to just 1 cpu */ 3297 - e->cpuid = cpumask_first(mask); 3298 - 3299 - ha = rsp->hw; 3300 - base_vha = pci_get_drvdata(ha->pdev); 3301 - 3302 - ql_dbg(ql_dbg_init, base_vha, 0xffff, 3303 - "%s: host %ld : vector %d cpu %d \n", __func__, 3304 - base_vha->host_no, e->vector, e->cpuid); 3305 - 3306 - if (e->have_irq) { 3307 - if ((IS_QLA83XX(ha) || IS_QLA27XX(ha)) && 3308 - (e->entry == QLA83XX_RSPQ_MSIX_ENTRY_NUMBER)) { 3309 - ha->tgt.rspq_vector_cpuid = e->cpuid; 3310 - ql_dbg(ql_dbg_init, base_vha, 0xffff, 3311 - "%s: host%ld: rspq vector %d cpu %d runtime change\n", 3312 - __func__, base_vha->host_no, e->vector, e->cpuid); 3313 - } 3314 - } 3315 - } 3316 - 3317 - static void qla_irq_affinity_release(struct kref *ref) 3318 - { 3319 - struct irq_affinity_notify *notify = 3320 - container_of(ref, struct irq_affinity_notify, kref); 3321 - struct qla_msix_entry *e = 3322 - container_of(notify, struct qla_msix_entry, irq_notify); 3323 - struct rsp_que *rsp = e->handle; 3324 - struct scsi_qla_host *base_vha = pci_get_drvdata(rsp->hw->pdev); 3325 - 3326 - ql_dbg(ql_dbg_init, base_vha, 0xffff, 3327 - "%s: host%ld: vector %d cpu %d\n", __func__, 3328 - base_vha->host_no, e->vector, e->cpuid); 3329 3303 }
+1 -1
drivers/scsi/qla2xxx/qla_os.c
··· 466 466 continue; 467 467 468 468 rsp = ha->rsp_q_map[cnt]; 469 - clear_bit(cnt, ha->req_qid_map); 469 + clear_bit(cnt, ha->rsp_qid_map); 470 470 ha->rsp_q_map[cnt] = NULL; 471 471 spin_unlock_irqrestore(&ha->hardware_lock, flags); 472 472 qla2x00_free_rsp_que(ha, rsp);
+16 -7
drivers/scsi/sd.c
··· 2585 2585 if (sdp->broken_fua) { 2586 2586 sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); 2587 2587 sdkp->DPOFUA = 0; 2588 - } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { 2588 + } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw && 2589 + !sdkp->device->use_16_for_rw) { 2589 2590 sd_first_printk(KERN_NOTICE, sdkp, 2590 2591 "Uses READ/WRITE(6), disabling FUA\n"); 2591 2592 sdkp->DPOFUA = 0; ··· 2769 2768 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q); 2770 2769 } 2771 2770 2772 - sdkp->zoned = (buffer[8] >> 4) & 3; 2773 - if (sdkp->zoned == 1) 2774 - q->limits.zoned = BLK_ZONED_HA; 2775 - else if (sdkp->device->type == TYPE_ZBC) 2771 + if (sdkp->device->type == TYPE_ZBC) { 2772 + /* Host-managed */ 2776 2773 q->limits.zoned = BLK_ZONED_HM; 2777 - else 2778 - q->limits.zoned = BLK_ZONED_NONE; 2774 + } else { 2775 + sdkp->zoned = (buffer[8] >> 4) & 3; 2776 + if (sdkp->zoned == 1) 2777 + /* Host-aware */ 2778 + q->limits.zoned = BLK_ZONED_HA; 2779 + else 2780 + /* 2781 + * Treat drive-managed devices as 2782 + * regular block devices. 2783 + */ 2784 + q->limits.zoned = BLK_ZONED_NONE; 2785 + } 2779 2786 if (blk_queue_is_zoned(q) && sdkp->first_scan) 2780 2787 sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n", 2781 2788 q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
+1 -1
drivers/scsi/ses.c
··· 587 587 588 588 ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); 589 589 590 - if (scsi_is_sas_rphy(&sdev->sdev_gendev)) 590 + if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent)) 591 591 efd.addr = sas_get_address(sdev); 592 592 593 593 if (efd.addr) {
+3 -3
include/scsi/libfc.h
··· 809 809 /** 810 810 * fc_set_wwpn() - Set the World Wide Port Name of a local port 811 811 * @lport: The local port whose WWPN is to be set 812 - * @wwnn: The new WWPN 812 + * @wwpn: The new WWPN 813 813 */ 814 - static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn) 814 + static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwpn) 815 815 { 816 - lport->wwpn = wwnn; 816 + lport->wwpn = wwpn; 817 817 } 818 818 819 819 /**