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:
"Thirteen fixes, seven of which are for IBM fibre channel and three
additional for fairly serious bugs in drivers (qla2xxx, mpt3sas,
aacraid).

Of the three core fixes, the most significant is probably the missed
run queue causing an indefinite hang. The others are fixing a
potential use after free on device close and silencing an incorrect
warning"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ibmvfc: Clean up transport events
scsi: ibmvfc: Byte swap status and error codes when logging
scsi: ibmvfc: Add failed PRLI to cmd_status lookup array
scsi: ibmvfc: Remove "failed" from logged errors
scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN
scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices
scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host
scsi: sd: Quiesce warning if device does not report optimal I/O size
scsi: sd: Fix a race between closing an sd device and sd I/O
scsi: core: Run queue when state is set to running after being blocked
scsi: qla4xxx: fix a potential NULL pointer dereference
scsi: aacraid: Insure we don't access PCIe space during AER/EEH
scsi: mpt3sas: Fix kernel panic during expander reset

+118 -31
+17
drivers/s390/scsi/zfcp_erp.c
··· 624 624 add_timer(&erp_action->timer); 625 625 } 626 626 627 + void zfcp_erp_port_forced_reopen_all(struct zfcp_adapter *adapter, 628 + int clear, char *dbftag) 629 + { 630 + unsigned long flags; 631 + struct zfcp_port *port; 632 + 633 + write_lock_irqsave(&adapter->erp_lock, flags); 634 + read_lock(&adapter->port_list_lock); 635 + list_for_each_entry(port, &adapter->port_list, list) 636 + _zfcp_erp_port_forced_reopen(port, clear, dbftag); 637 + read_unlock(&adapter->port_list_lock); 638 + write_unlock_irqrestore(&adapter->erp_lock, flags); 639 + } 640 + 627 641 static void _zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, 628 642 int clear, char *dbftag) 629 643 { ··· 1355 1341 struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev); 1356 1342 int lun_status; 1357 1343 1344 + if (sdev->sdev_state == SDEV_DEL || 1345 + sdev->sdev_state == SDEV_CANCEL) 1346 + continue; 1358 1347 if (zsdev->port != port) 1359 1348 continue; 1360 1349 /* LUN under port of interest */
+2
drivers/s390/scsi/zfcp_ext.h
··· 70 70 char *dbftag); 71 71 extern void zfcp_erp_port_shutdown(struct zfcp_port *, int, char *); 72 72 extern void zfcp_erp_port_forced_reopen(struct zfcp_port *, int, char *); 73 + extern void zfcp_erp_port_forced_reopen_all(struct zfcp_adapter *adapter, 74 + int clear, char *dbftag); 73 75 extern void zfcp_erp_set_lun_status(struct scsi_device *, u32); 74 76 extern void zfcp_erp_clear_lun_status(struct scsi_device *, u32); 75 77 extern void zfcp_erp_lun_reopen(struct scsi_device *, int, char *);
+17 -4
drivers/s390/scsi/zfcp_fc.c
··· 239 239 list_for_each_entry(port, &adapter->port_list, list) { 240 240 if ((port->d_id & range) == (ntoh24(page->rscn_fid) & range)) 241 241 zfcp_fc_test_link(port); 242 - if (!port->d_id) 243 - zfcp_erp_port_reopen(port, 244 - ZFCP_STATUS_COMMON_ERP_FAILED, 245 - "fcrscn1"); 246 242 } 247 243 read_unlock_irqrestore(&adapter->port_list_lock, flags); 248 244 } ··· 246 250 static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) 247 251 { 248 252 struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data; 253 + struct zfcp_adapter *adapter = fsf_req->adapter; 249 254 struct fc_els_rscn *head; 250 255 struct fc_els_rscn_page *page; 251 256 u16 i; ··· 259 262 /* see FC-FS */ 260 263 no_entries = be16_to_cpu(head->rscn_plen) / 261 264 sizeof(struct fc_els_rscn_page); 265 + 266 + if (no_entries > 1) { 267 + /* handle failed ports */ 268 + unsigned long flags; 269 + struct zfcp_port *port; 270 + 271 + read_lock_irqsave(&adapter->port_list_lock, flags); 272 + list_for_each_entry(port, &adapter->port_list, list) { 273 + if (port->d_id) 274 + continue; 275 + zfcp_erp_port_reopen(port, 276 + ZFCP_STATUS_COMMON_ERP_FAILED, 277 + "fcrscn1"); 278 + } 279 + read_unlock_irqrestore(&adapter->port_list_lock, flags); 280 + } 262 281 263 282 for (i = 1; i < no_entries; i++) { 264 283 /* skip head and start with 1st element */
+4
drivers/s390/scsi/zfcp_scsi.c
··· 368 368 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; 369 369 int ret = SUCCESS, fc_ret; 370 370 371 + if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) { 372 + zfcp_erp_port_forced_reopen_all(adapter, 0, "schrh_p"); 373 + zfcp_erp_wait(adapter); 374 + } 371 375 zfcp_erp_adapter_reopen(adapter, 0, "schrh_1"); 372 376 zfcp_erp_wait(adapter); 373 377 fc_ret = fc_block_scsi_eh(scpnt);
+6 -1
drivers/scsi/aacraid/aacraid.h
··· 2640 2640 return capacity; 2641 2641 } 2642 2642 2643 + static inline int aac_pci_offline(struct aac_dev *dev) 2644 + { 2645 + return pci_channel_offline(dev->pdev) || dev->handle_pci_error; 2646 + } 2647 + 2643 2648 static inline int aac_adapter_check_health(struct aac_dev *dev) 2644 2649 { 2645 - if (unlikely(pci_channel_offline(dev->pdev))) 2650 + if (unlikely(aac_pci_offline(dev))) 2646 2651 return -1; 2647 2652 2648 2653 return (dev)->a_ops.adapter_check_health(dev);
+2 -2
drivers/scsi/aacraid/commsup.c
··· 672 672 return -ETIMEDOUT; 673 673 } 674 674 675 - if (unlikely(pci_channel_offline(dev->pdev))) 675 + if (unlikely(aac_pci_offline(dev))) 676 676 return -EFAULT; 677 677 678 678 if ((blink = aac_adapter_check_health(dev)) > 0) { ··· 772 772 773 773 spin_unlock_irqrestore(&fibptr->event_lock, flags); 774 774 775 - if (unlikely(pci_channel_offline(dev->pdev))) 775 + if (unlikely(aac_pci_offline(dev))) 776 776 return -EFAULT; 777 777 778 778 fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
+22 -17
drivers/scsi/ibmvscsi/ibmvfc.c
··· 139 139 { IBMVFC_FC_FAILURE, IBMVFC_VENDOR_SPECIFIC, DID_ERROR, 1, 1, "vendor specific" }, 140 140 141 141 { IBMVFC_FC_SCSI_ERROR, 0, DID_OK, 1, 0, "SCSI error" }, 142 + { IBMVFC_FC_SCSI_ERROR, IBMVFC_COMMAND_FAILED, DID_ERROR, 0, 1, "PRLI to device failed." }, 142 143 }; 143 144 144 145 static void ibmvfc_npiv_login(struct ibmvfc_host *); ··· 1495 1494 if (rsp->flags & FCP_RSP_LEN_VALID) 1496 1495 rsp_code = rsp->data.info.rsp_code; 1497 1496 1498 - scmd_printk(KERN_ERR, cmnd, "Command (%02X) failed: %s (%x:%x) " 1497 + scmd_printk(KERN_ERR, cmnd, "Command (%02X) : %s (%x:%x) " 1499 1498 "flags: %x fcp_rsp: %x, resid=%d, scsi_status: %x\n", 1500 - cmnd->cmnd[0], err, vfc_cmd->status, vfc_cmd->error, 1499 + cmnd->cmnd[0], err, be16_to_cpu(vfc_cmd->status), be16_to_cpu(vfc_cmd->error), 1501 1500 rsp->flags, rsp_code, scsi_get_resid(cmnd), rsp->scsi_status); 1502 1501 } 1503 1502 ··· 2023 2022 sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) " 2024 2023 "flags: %x fcp_rsp: %x, scsi_status: %x\n", desc, 2025 2024 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), 2026 - rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2025 + be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error), fc_rsp->flags, rsp_code, 2027 2026 fc_rsp->scsi_status); 2028 2027 rsp_rc = -EIO; 2029 2028 } else ··· 2382 2381 sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " 2383 2382 "flags: %x fcp_rsp: %x, scsi_status: %x\n", 2384 2383 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), 2385 - rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2384 + be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error), fc_rsp->flags, rsp_code, 2386 2385 fc_rsp->scsi_status); 2387 2386 rsp_rc = -EIO; 2388 2387 } else ··· 2756 2755 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE); 2757 2756 if (crq->format == IBMVFC_PARTITION_MIGRATED) { 2758 2757 /* We need to re-setup the interpartition connection */ 2759 - dev_info(vhost->dev, "Re-enabling adapter\n"); 2758 + dev_info(vhost->dev, "Partition migrated, Re-enabling adapter\n"); 2760 2759 vhost->client_migrated = 1; 2761 2760 ibmvfc_purge_requests(vhost, DID_REQUEUE); 2762 2761 ibmvfc_link_down(vhost, IBMVFC_LINK_DOWN); 2763 2762 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_REENABLE); 2764 - } else { 2765 - dev_err(vhost->dev, "Virtual adapter failed (rc=%d)\n", crq->format); 2763 + } else if (crq->format == IBMVFC_PARTNER_FAILED || crq->format == IBMVFC_PARTNER_DEREGISTER) { 2764 + dev_err(vhost->dev, "Host partner adapter deregistered or failed (rc=%d)\n", crq->format); 2766 2765 ibmvfc_purge_requests(vhost, DID_ERROR); 2767 2766 ibmvfc_link_down(vhost, IBMVFC_LINK_DOWN); 2768 2767 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_RESET); 2768 + } else { 2769 + dev_err(vhost->dev, "Received unknown transport event from partner (rc=%d)\n", crq->format); 2769 2770 } 2770 2771 return; 2771 2772 case IBMVFC_CRQ_CMD_RSP: ··· 3351 3348 3352 3349 tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n", 3353 3350 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3354 - rsp->status, rsp->error, status); 3351 + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error), status); 3355 3352 break; 3356 3353 } 3357 3354 ··· 3449 3446 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); 3450 3447 3451 3448 tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3452 - ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), rsp->status, rsp->error, 3453 - ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), rsp->fc_type, 3454 - ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), rsp->fc_explain, status); 3449 + ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3450 + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error), 3451 + ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type), 3452 + ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->fc_explain), status); 3455 3453 break; 3456 3454 } 3457 3455 ··· 3623 3619 fc_explain = (be32_to_cpu(mad->fc_iu.response[1]) & 0x0000ff00) >> 8; 3624 3620 tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3625 3621 ibmvfc_get_cmd_error(be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error)), 3626 - mad->iu.status, mad->iu.error, 3622 + be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error), 3627 3623 ibmvfc_get_fc_type(fc_reason), fc_reason, 3628 3624 ibmvfc_get_ls_explain(fc_explain), fc_explain, status); 3629 3625 break; ··· 3835 3831 3836 3832 tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3837 3833 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3838 - rsp->status, rsp->error, ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), 3839 - rsp->fc_type, ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), 3840 - rsp->fc_explain, status); 3834 + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error), 3835 + ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type), 3836 + ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->fc_explain), 3837 + status); 3841 3838 break; 3842 3839 } 3843 3840 ··· 3964 3959 level += ibmvfc_retry_host_init(vhost); 3965 3960 ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", 3966 3961 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3967 - rsp->status, rsp->error); 3962 + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); 3968 3963 break; 3969 3964 case IBMVFC_MAD_DRIVER_FAILED: 3970 3965 break; ··· 4029 4024 ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); 4030 4025 ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n", 4031 4026 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 4032 - rsp->status, rsp->error); 4027 + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); 4033 4028 ibmvfc_free_event(evt); 4034 4029 return; 4035 4030 case IBMVFC_MAD_CRQ_ERROR:
+6 -1
drivers/scsi/ibmvscsi/ibmvfc.h
··· 78 78 IBMVFC_CRQ_XPORT_EVENT = 0xFF, 79 79 }; 80 80 81 - enum ibmvfc_crq_format { 81 + enum ibmvfc_crq_init_msg { 82 82 IBMVFC_CRQ_INIT = 0x01, 83 83 IBMVFC_CRQ_INIT_COMPLETE = 0x02, 84 + }; 85 + 86 + enum ibmvfc_crq_xport_evts { 87 + IBMVFC_PARTNER_FAILED = 0x01, 88 + IBMVFC_PARTNER_DEREGISTER = 0x02, 84 89 IBMVFC_PARTITION_MIGRATED = 0x06, 85 90 }; 86 91
+6
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 3281 3281 3282 3282 if (smid < ioc->hi_priority_smid) { 3283 3283 struct scsiio_tracker *st; 3284 + void *request; 3284 3285 3285 3286 st = _get_st_from_smid(ioc, smid); 3286 3287 if (!st) { 3287 3288 _base_recovery_check(ioc); 3288 3289 return; 3289 3290 } 3291 + 3292 + /* Clear MPI request frame */ 3293 + request = mpt3sas_base_get_msg_frame(ioc, smid); 3294 + memset(request, 0, ioc->request_sz); 3295 + 3290 3296 mpt3sas_base_clear_st(ioc, st); 3291 3297 _base_recovery_check(ioc); 3292 3298 return;
+12
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 1462 1462 { 1463 1463 struct scsi_cmnd *scmd = NULL; 1464 1464 struct scsiio_tracker *st; 1465 + Mpi25SCSIIORequest_t *mpi_request; 1465 1466 1466 1467 if (smid > 0 && 1467 1468 smid <= ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT) { 1468 1469 u32 unique_tag = smid - 1; 1470 + 1471 + mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); 1472 + 1473 + /* 1474 + * If SCSI IO request is outstanding at driver level then 1475 + * DevHandle filed must be non-zero. If DevHandle is zero 1476 + * then it means that this smid is free at driver level, 1477 + * so return NULL. 1478 + */ 1479 + if (!mpi_request->DevHandle) 1480 + return scmd; 1469 1481 1470 1482 scmd = scsi_host_find_tag(ioc->shost, unique_tag); 1471 1483 if (scmd) {
+2
drivers/scsi/qla4xxx/ql4_os.c
··· 3203 3203 if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) 3204 3204 return -EINVAL; 3205 3205 ep = iscsi_lookup_endpoint(transport_fd); 3206 + if (!ep) 3207 + return -EINVAL; 3206 3208 conn = cls_conn->dd_data; 3207 3209 qla_conn = conn->dd_data; 3208 3210 qla_conn->qla_ep = ep->dd_data;
+6
drivers/scsi/scsi_sysfs.c
··· 771 771 772 772 mutex_lock(&sdev->state_mutex); 773 773 ret = scsi_device_set_state(sdev, state); 774 + /* 775 + * If the device state changes to SDEV_RUNNING, we need to run 776 + * the queue to avoid I/O hang. 777 + */ 778 + if (ret == 0 && state == SDEV_RUNNING) 779 + blk_mq_run_hw_queues(sdev->request_queue, true); 774 780 mutex_unlock(&sdev->state_mutex); 775 781 776 782 return ret == 0 ? count : -EINVAL;
+16 -6
drivers/scsi/sd.c
··· 1415 1415 scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); 1416 1416 } 1417 1417 1418 - /* 1419 - * XXX and what if there are packets in flight and this close() 1420 - * XXX is followed by a "rmmod sd_mod"? 1421 - */ 1422 - 1423 1418 scsi_disk_put(sdkp); 1424 1419 } 1425 1420 ··· 3071 3076 unsigned int opt_xfer_bytes = 3072 3077 logical_to_bytes(sdp, sdkp->opt_xfer_blocks); 3073 3078 3079 + if (sdkp->opt_xfer_blocks == 0) 3080 + return false; 3081 + 3074 3082 if (sdkp->opt_xfer_blocks > dev_max) { 3075 3083 sd_first_printk(KERN_WARNING, sdkp, 3076 3084 "Optimal transfer size %u logical blocks " \ ··· 3503 3505 { 3504 3506 struct scsi_disk *sdkp = to_scsi_disk(dev); 3505 3507 struct gendisk *disk = sdkp->disk; 3506 - 3508 + struct request_queue *q = disk->queue; 3509 + 3507 3510 ida_free(&sd_index_ida, sdkp->index); 3511 + 3512 + /* 3513 + * Wait until all requests that are in progress have completed. 3514 + * This is necessary to avoid that e.g. scsi_end_request() crashes 3515 + * due to clearing the disk->private_data pointer. Wait from inside 3516 + * scsi_disk_release() instead of from sd_release() to avoid that 3517 + * freezing and unfreezing the request queue affects user space I/O 3518 + * in case multiple processes open a /dev/sd... node concurrently. 3519 + */ 3520 + blk_mq_freeze_queue(q); 3521 + blk_mq_unfreeze_queue(q); 3508 3522 3509 3523 disk->private_data = NULL; 3510 3524 put_disk(disk);