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

Merge branch '5.12/scsi-fixes' into 5.13/scsi-staging

Pull 5.12/scsi-fixes into the 5.13 SCSI tree to provide a baseline for
some UFS changes that would otherwise cause conflicts during the
merge.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+168 -103
+1 -1
MAINTAINERS
··· 19165 19165 F: drivers/infiniband/hw/vmw_pvrdma/ 19166 19166 19167 19167 VMware PVSCSI driver 19168 - M: Jim Gill <jgill@vmware.com> 19168 + M: Vishal Bhakta <vbhakta@vmware.com> 19169 19169 M: VMware PV-Drivers <pv-drivers@vmware.com> 19170 19170 L: linux-scsi@vger.kernel.org 19171 19171 S: Maintained
+92 -39
drivers/scsi/ibmvscsi/ibmvfc.c
··· 21 21 #include <linux/bsg-lib.h> 22 22 #include <asm/firmware.h> 23 23 #include <asm/irq.h> 24 + #include <asm/rtas.h> 24 25 #include <asm/vio.h> 25 26 #include <scsi/scsi.h> 26 27 #include <scsi/scsi_cmnd.h> ··· 158 157 static void ibmvfc_npiv_logout(struct ibmvfc_host *); 159 158 static void ibmvfc_tgt_implicit_logout_and_del(struct ibmvfc_target *); 160 159 static void ibmvfc_tgt_move_login(struct ibmvfc_target *); 160 + 161 + static void ibmvfc_release_sub_crqs(struct ibmvfc_host *); 162 + static void ibmvfc_init_sub_crqs(struct ibmvfc_host *); 161 163 162 164 static const char *unknown_error = "unknown error"; 163 165 ··· 905 901 { 906 902 int rc = 0; 907 903 struct vio_dev *vdev = to_vio_dev(vhost->dev); 904 + unsigned long flags; 905 + 906 + ibmvfc_release_sub_crqs(vhost); 908 907 909 908 /* Re-enable the CRQ */ 910 909 do { ··· 918 911 919 912 if (rc) 920 913 dev_err(vhost->dev, "Error enabling adapter (rc=%d)\n", rc); 914 + 915 + spin_lock_irqsave(vhost->host->host_lock, flags); 916 + spin_lock(vhost->crq.q_lock); 917 + vhost->do_enquiry = 1; 918 + vhost->using_channels = 0; 919 + spin_unlock(vhost->crq.q_lock); 920 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 921 + 922 + ibmvfc_init_sub_crqs(vhost); 921 923 922 924 return rc; 923 925 } ··· 944 928 unsigned long flags; 945 929 struct vio_dev *vdev = to_vio_dev(vhost->dev); 946 930 struct ibmvfc_queue *crq = &vhost->crq; 947 - struct ibmvfc_queue *scrq; 948 - int i; 931 + 932 + ibmvfc_release_sub_crqs(vhost); 949 933 950 934 /* Close the CRQ */ 951 935 do { ··· 965 949 memset(crq->msgs.crq, 0, PAGE_SIZE); 966 950 crq->cur = 0; 967 951 968 - if (vhost->scsi_scrqs.scrqs) { 969 - for (i = 0; i < nr_scsi_hw_queues; i++) { 970 - scrq = &vhost->scsi_scrqs.scrqs[i]; 971 - spin_lock(scrq->q_lock); 972 - memset(scrq->msgs.scrq, 0, PAGE_SIZE); 973 - scrq->cur = 0; 974 - spin_unlock(scrq->q_lock); 975 - } 976 - } 977 - 978 952 /* And re-open it again */ 979 953 rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address, 980 954 crq->msg_token, PAGE_SIZE); ··· 974 968 dev_warn(vhost->dev, "Partner adapter not ready\n"); 975 969 else if (rc != 0) 976 970 dev_warn(vhost->dev, "Couldn't register crq (rc=%d)\n", rc); 971 + 977 972 spin_unlock(vhost->crq.q_lock); 978 973 spin_unlock_irqrestore(vhost->host->host_lock, flags); 974 + 975 + ibmvfc_init_sub_crqs(vhost); 979 976 980 977 return rc; 981 978 } ··· 2375 2366 } 2376 2367 2377 2368 /** 2369 + * ibmvfc_event_is_free - Check if event is free or not 2370 + * @evt: ibmvfc event struct 2371 + * 2372 + * Returns: 2373 + * true / false 2374 + **/ 2375 + static bool ibmvfc_event_is_free(struct ibmvfc_event *evt) 2376 + { 2377 + struct ibmvfc_event *loop_evt; 2378 + 2379 + list_for_each_entry(loop_evt, &evt->queue->free, queue_list) 2380 + if (loop_evt == evt) 2381 + return true; 2382 + 2383 + return false; 2384 + } 2385 + 2386 + /** 2378 2387 * ibmvfc_wait_for_ops - Wait for ops to complete 2379 2388 * @vhost: ibmvfc host struct 2380 2389 * @device: device to match (starget or sdev) ··· 2406 2379 { 2407 2380 struct ibmvfc_event *evt; 2408 2381 DECLARE_COMPLETION_ONSTACK(comp); 2409 - int wait; 2382 + int wait, i, q_index, q_size; 2410 2383 unsigned long flags; 2411 2384 signed long timeout = IBMVFC_ABORT_WAIT_TIMEOUT * HZ; 2385 + struct ibmvfc_queue *queues; 2412 2386 2413 2387 ENTER; 2388 + if (vhost->mq_enabled && vhost->using_channels) { 2389 + queues = vhost->scsi_scrqs.scrqs; 2390 + q_size = vhost->scsi_scrqs.active_queues; 2391 + } else { 2392 + queues = &vhost->crq; 2393 + q_size = 1; 2394 + } 2395 + 2414 2396 do { 2415 2397 wait = 0; 2416 - spin_lock_irqsave(&vhost->crq.l_lock, flags); 2417 - list_for_each_entry(evt, &vhost->crq.sent, queue_list) { 2418 - if (match(evt, device)) { 2419 - evt->eh_comp = &comp; 2420 - wait++; 2398 + spin_lock_irqsave(vhost->host->host_lock, flags); 2399 + for (q_index = 0; q_index < q_size; q_index++) { 2400 + spin_lock(&queues[q_index].l_lock); 2401 + for (i = 0; i < queues[q_index].evt_pool.size; i++) { 2402 + evt = &queues[q_index].evt_pool.events[i]; 2403 + if (!ibmvfc_event_is_free(evt)) { 2404 + if (match(evt, device)) { 2405 + evt->eh_comp = &comp; 2406 + wait++; 2407 + } 2408 + } 2421 2409 } 2410 + spin_unlock(&queues[q_index].l_lock); 2422 2411 } 2423 - spin_unlock_irqrestore(&vhost->crq.l_lock, flags); 2412 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2424 2413 2425 2414 if (wait) { 2426 2415 timeout = wait_for_completion_timeout(&comp, timeout); 2427 2416 2428 2417 if (!timeout) { 2429 2418 wait = 0; 2430 - spin_lock_irqsave(&vhost->crq.l_lock, flags); 2431 - list_for_each_entry(evt, &vhost->crq.sent, queue_list) { 2432 - if (match(evt, device)) { 2433 - evt->eh_comp = NULL; 2434 - wait++; 2419 + spin_lock_irqsave(vhost->host->host_lock, flags); 2420 + for (q_index = 0; q_index < q_size; q_index++) { 2421 + spin_lock(&queues[q_index].l_lock); 2422 + for (i = 0; i < queues[q_index].evt_pool.size; i++) { 2423 + evt = &queues[q_index].evt_pool.events[i]; 2424 + if (!ibmvfc_event_is_free(evt)) { 2425 + if (match(evt, device)) { 2426 + evt->eh_comp = NULL; 2427 + wait++; 2428 + } 2429 + } 2435 2430 } 2431 + spin_unlock(&queues[q_index].l_lock); 2436 2432 } 2437 - spin_unlock_irqrestore(&vhost->crq.l_lock, flags); 2433 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2438 2434 if (wait) 2439 2435 dev_err(vhost->dev, "Timed out waiting for aborted commands\n"); 2440 2436 LEAVE; ··· 5699 5649 rc = h_reg_sub_crq(vdev->unit_address, scrq->msg_token, PAGE_SIZE, 5700 5650 &scrq->cookie, &scrq->hw_irq); 5701 5651 5702 - if (rc) { 5652 + /* H_CLOSED indicates successful register, but no CRQ partner */ 5653 + if (rc && rc != H_CLOSED) { 5703 5654 dev_warn(dev, "Error registering sub-crq: %d\n", rc); 5704 5655 if (rc == H_PARAMETER) 5705 5656 dev_warn_once(dev, "Firmware may not support MQ\n"); ··· 5733 5682 5734 5683 irq_failed: 5735 5684 do { 5736 - plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie); 5737 - } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); 5685 + rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie); 5686 + } while (rtas_busy_delay(rc)); 5738 5687 reg_failed: 5739 5688 ibmvfc_free_queue(vhost, scrq); 5740 5689 LEAVE; ··· 5752 5701 5753 5702 free_irq(scrq->irq, scrq); 5754 5703 irq_dispose_mapping(scrq->irq); 5704 + scrq->irq = 0; 5755 5705 5756 5706 do { 5757 5707 rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, ··· 5766 5714 LEAVE; 5767 5715 } 5768 5716 5769 - static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) 5717 + static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) 5770 5718 { 5771 5719 int i, j; 5772 5720 5773 5721 ENTER; 5722 + if (!vhost->mq_enabled) 5723 + return; 5774 5724 5775 5725 vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues, 5776 5726 sizeof(*vhost->scsi_scrqs.scrqs), 5777 5727 GFP_KERNEL); 5778 - if (!vhost->scsi_scrqs.scrqs) 5779 - return -1; 5728 + if (!vhost->scsi_scrqs.scrqs) { 5729 + vhost->do_enquiry = 0; 5730 + return; 5731 + } 5780 5732 5781 5733 for (i = 0; i < nr_scsi_hw_queues; i++) { 5782 5734 if (ibmvfc_register_scsi_channel(vhost, i)) { ··· 5789 5733 kfree(vhost->scsi_scrqs.scrqs); 5790 5734 vhost->scsi_scrqs.scrqs = NULL; 5791 5735 vhost->scsi_scrqs.active_queues = 0; 5792 - LEAVE; 5793 - return -1; 5736 + vhost->do_enquiry = 0; 5737 + break; 5794 5738 } 5795 5739 } 5796 5740 5797 5741 LEAVE; 5798 - return 0; 5799 5742 } 5800 5743 5801 5744 static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost) ··· 5832 5777 vhost->disc_buf_dma); 5833 5778 dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf), 5834 5779 vhost->login_buf, vhost->login_buf_dma); 5780 + dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf), 5781 + vhost->channel_setup_buf, vhost->channel_setup_dma); 5835 5782 dma_pool_destroy(vhost->sg_pool); 5836 5783 ibmvfc_free_queue(vhost, async_q); 5837 5784 LEAVE; ··· 6063 6006 goto remove_shost; 6064 6007 } 6065 6008 6066 - if (vhost->mq_enabled) { 6067 - rc = ibmvfc_init_sub_crqs(vhost); 6068 - if (rc) 6069 - dev_warn(dev, "Failed to allocate Sub-CRQs. rc=%d\n", rc); 6070 - } 6009 + ibmvfc_init_sub_crqs(vhost); 6071 6010 6072 6011 if (shost_to_fc_host(shost)->rqst_q) 6073 6012 blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1);
+2 -2
drivers/scsi/lpfc/lpfc_debugfs.c
··· 2424 2424 memset(dstbuf, 0, 33); 2425 2425 size = (nbytes < 32) ? nbytes : 32; 2426 2426 if (copy_from_user(dstbuf, buf, size)) 2427 - return 0; 2427 + return -EFAULT; 2428 2428 2429 2429 if (dent == phba->debug_InjErrLBA) { 2430 2430 if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && ··· 2433 2433 } 2434 2434 2435 2435 if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) 2436 - return 0; 2436 + return -EINVAL; 2437 2437 2438 2438 if (dent == phba->debug_writeGuard) 2439 2439 phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
+6 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 7960 7960 ioc->pend_os_device_add_sz++; 7961 7961 ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz, 7962 7962 GFP_KERNEL); 7963 - if (!ioc->pend_os_device_add) 7963 + if (!ioc->pend_os_device_add) { 7964 + r = -ENOMEM; 7964 7965 goto out_free_resources; 7966 + } 7965 7967 7966 7968 ioc->device_remove_in_progress_sz = ioc->pend_os_device_add_sz; 7967 7969 ioc->device_remove_in_progress = 7968 7970 kzalloc(ioc->device_remove_in_progress_sz, GFP_KERNEL); 7969 - if (!ioc->device_remove_in_progress) 7971 + if (!ioc->device_remove_in_progress) { 7972 + r = -ENOMEM; 7970 7973 goto out_free_resources; 7974 + } 7971 7975 7972 7976 ioc->fwfault_debug = mpt3sas_fwfault_debug; 7973 7977
+1 -1
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 413 413 * And add this object to port_table_list. 414 414 */ 415 415 if (!ioc->multipath_on_hba) { 416 - port = kzalloc(sizeof(struct hba_port), GFP_KERNEL); 416 + port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC); 417 417 if (!port) 418 418 return NULL; 419 419
+1 -1
drivers/scsi/myrs.c
··· 2271 2271 if (cs->mmio_base) { 2272 2272 cs->disable_intr(cs); 2273 2273 iounmap(cs->mmio_base); 2274 + cs->mmio_base = NULL; 2274 2275 } 2275 2276 if (cs->irq) 2276 2277 free_irq(cs->irq, cs); 2277 2278 if (cs->io_addr) 2278 2279 release_region(cs->io_addr, 0x80); 2279 - iounmap(cs->mmio_base); 2280 2280 pci_set_drvdata(pdev, NULL); 2281 2281 pci_disable_device(pdev); 2282 2282 scsi_host_put(cs->host);
+1
drivers/scsi/qedi/qedi_main.c
··· 1673 1673 if (!qedi->global_queues[i]) { 1674 1674 QEDI_ERR(&qedi->dbg_ctx, 1675 1675 "Unable to allocation global queue %d.\n", i); 1676 + status = -ENOMEM; 1676 1677 goto mem_alloc_failure; 1677 1678 } 1678 1679
+5 -8
drivers/scsi/qla2xxx/qla_target.c
··· 3227 3227 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || 3228 3228 (cmd->sess && cmd->sess->deleted)) { 3229 3229 cmd->state = QLA_TGT_STATE_PROCESSED; 3230 - res = 0; 3231 - goto free; 3230 + return 0; 3232 3231 } 3233 3232 3234 3233 ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, ··· 3238 3239 3239 3240 res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, 3240 3241 &full_req_cnt); 3241 - if (unlikely(res != 0)) 3242 - goto free; 3242 + if (unlikely(res != 0)) { 3243 + return res; 3244 + } 3243 3245 3244 3246 spin_lock_irqsave(qpair->qp_lock_ptr, flags); 3245 3247 ··· 3260 3260 vha->flags.online, qla2x00_reset_active(vha), 3261 3261 cmd->reset_count, qpair->chip_reset); 3262 3262 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3263 - res = 0; 3264 - goto free; 3263 + return 0; 3265 3264 } 3266 3265 3267 3266 /* Does F/W have an IOCBs for this request */ ··· 3363 3364 qlt_unmap_sg(vha, cmd); 3364 3365 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3365 3366 3366 - free: 3367 - vha->hw->tgt.tgt_ops->free_cmd(cmd); 3368 3367 return res; 3369 3368 } 3370 3369 EXPORT_SYMBOL(qlt_xmit_response);
+1 -1
drivers/scsi/qla2xxx/qla_target.h
··· 116 116 (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ 117 117 QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) 118 118 #endif 119 - #endif 120 119 121 120 #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ 122 121 ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ ··· 243 244 #ifndef CTIO_RET_TYPE 244 245 #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ 245 246 #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ 247 + #endif 246 248 247 249 struct fcp_hdr { 248 250 uint8_t r_ctl;
-4
drivers/scsi/qla2xxx/tcm_qla2xxx.c
··· 653 653 { 654 654 struct qla_tgt_cmd *cmd = container_of(se_cmd, 655 655 struct qla_tgt_cmd, se_cmd); 656 - struct scsi_qla_host *vha = cmd->vha; 657 656 658 657 if (cmd->aborted) { 659 658 /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task ··· 665 666 cmd->se_cmd.transport_state, 666 667 cmd->se_cmd.t_state, 667 668 cmd->se_cmd.se_cmd_flags); 668 - vha->hw->tgt.tgt_ops->free_cmd(cmd); 669 669 return 0; 670 670 } 671 671 ··· 692 694 { 693 695 struct qla_tgt_cmd *cmd = container_of(se_cmd, 694 696 struct qla_tgt_cmd, se_cmd); 695 - struct scsi_qla_host *vha = cmd->vha; 696 697 int xmit_type = QLA_TGT_XMIT_STATUS; 697 698 698 699 if (cmd->aborted) { ··· 705 708 cmd, kref_read(&cmd->se_cmd.cmd_kref), 706 709 cmd->se_cmd.transport_state, cmd->se_cmd.t_state, 707 710 cmd->se_cmd.se_cmd_flags); 708 - vha->hw->tgt.tgt_ops->free_cmd(cmd); 709 711 return 0; 710 712 } 711 713 cmd->bufflen = se_cmd->data_length;
+13 -1
drivers/scsi/scsi_transport_iscsi.c
··· 2471 2471 */ 2472 2472 mutex_lock(&conn_mutex); 2473 2473 conn->transport->stop_conn(conn, flag); 2474 + conn->state = ISCSI_CONN_DOWN; 2474 2475 mutex_unlock(&conn_mutex); 2475 2476 2476 2477 } ··· 2895 2894 default: 2896 2895 err = transport->set_param(conn, ev->u.set_param.param, 2897 2896 data, ev->u.set_param.len); 2897 + if ((conn->state == ISCSI_CONN_BOUND) || 2898 + (conn->state == ISCSI_CONN_UP)) { 2899 + err = transport->set_param(conn, ev->u.set_param.param, 2900 + data, ev->u.set_param.len); 2901 + } else { 2902 + return -ENOTCONN; 2903 + } 2898 2904 } 2899 2905 2900 2906 return err; ··· 2961 2953 mutex_lock(&conn->ep_mutex); 2962 2954 conn->ep = NULL; 2963 2955 mutex_unlock(&conn->ep_mutex); 2956 + conn->state = ISCSI_CONN_DOWN; 2964 2957 } 2965 2958 2966 2959 transport->ep_disconnect(ep); ··· 3722 3713 ev->r.retcode = transport->bind_conn(session, conn, 3723 3714 ev->u.b_conn.transport_eph, 3724 3715 ev->u.b_conn.is_leading); 3716 + if (!ev->r.retcode) 3717 + conn->state = ISCSI_CONN_BOUND; 3725 3718 mutex_unlock(&conn_mutex); 3726 3719 3727 3720 if (ev->r.retcode || !transport->ep_connect) ··· 3955 3944 static const char *const connection_state_names[] = { 3956 3945 [ISCSI_CONN_UP] = "up", 3957 3946 [ISCSI_CONN_DOWN] = "down", 3958 - [ISCSI_CONN_FAILED] = "failed" 3947 + [ISCSI_CONN_FAILED] = "failed", 3948 + [ISCSI_CONN_BOUND] = "bound" 3959 3949 }; 3960 3950 3961 3951 static ssize_t show_conn_state(struct device *dev,
+11 -8
drivers/scsi/sd_zbc.c
··· 280 280 static void sd_zbc_update_wp_offset_workfn(struct work_struct *work) 281 281 { 282 282 struct scsi_disk *sdkp; 283 + unsigned long flags; 283 284 unsigned int zno; 284 285 int ret; 285 286 286 287 sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work); 287 288 288 - spin_lock_bh(&sdkp->zones_wp_offset_lock); 289 + spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); 289 290 for (zno = 0; zno < sdkp->nr_zones; zno++) { 290 291 if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST) 291 292 continue; 292 293 293 - spin_unlock_bh(&sdkp->zones_wp_offset_lock); 294 + spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); 294 295 ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf, 295 296 SD_BUF_SIZE, 296 297 zno * sdkp->zone_blocks, true); 297 - spin_lock_bh(&sdkp->zones_wp_offset_lock); 298 + spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); 298 299 if (!ret) 299 300 sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64, 300 301 zno, sd_zbc_update_wp_offset_cb, 301 302 sdkp); 302 303 } 303 - spin_unlock_bh(&sdkp->zones_wp_offset_lock); 304 + spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); 304 305 305 306 scsi_device_put(sdkp->device); 306 307 } ··· 325 324 struct request *rq = cmd->request; 326 325 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); 327 326 unsigned int wp_offset, zno = blk_rq_zone_no(rq); 327 + unsigned long flags; 328 328 blk_status_t ret; 329 329 330 330 ret = sd_zbc_cmnd_checks(cmd); ··· 339 337 if (!blk_req_zone_write_trylock(rq)) 340 338 return BLK_STS_ZONE_RESOURCE; 341 339 342 - spin_lock_bh(&sdkp->zones_wp_offset_lock); 340 + spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); 343 341 wp_offset = sdkp->zones_wp_offset[zno]; 344 342 switch (wp_offset) { 345 343 case SD_ZBC_INVALID_WP_OFST: ··· 368 366 369 367 *lba += wp_offset; 370 368 } 371 - spin_unlock_bh(&sdkp->zones_wp_offset_lock); 369 + spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); 372 370 if (ret) 373 371 blk_req_zone_write_unlock(rq); 374 372 return ret; ··· 447 445 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); 448 446 unsigned int zno = blk_rq_zone_no(rq); 449 447 enum req_opf op = req_op(rq); 448 + unsigned long flags; 450 449 451 450 /* 452 451 * If we got an error for a command that needs updating the write ··· 455 452 * invalid to force an update from disk the next time a zone append 456 453 * command is issued. 457 454 */ 458 - spin_lock_bh(&sdkp->zones_wp_offset_lock); 455 + spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags); 459 456 460 457 if (result && op != REQ_OP_ZONE_RESET_ALL) { 461 458 if (op == REQ_OP_ZONE_APPEND) { ··· 499 496 } 500 497 501 498 unlock_wp_offset: 502 - spin_unlock_bh(&sdkp->zones_wp_offset_lock); 499 + spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); 503 500 504 501 return good_bytes; 505 502 }
+1 -1
drivers/scsi/st.c
··· 1269 1269 spin_lock(&st_use_lock); 1270 1270 if (STp->in_use) { 1271 1271 spin_unlock(&st_use_lock); 1272 - scsi_tape_put(STp); 1273 1272 DEBC_printk(STp, "Device already in use.\n"); 1273 + scsi_tape_put(STp); 1274 1274 return (-EBUSY); 1275 1275 } 1276 1276
+1 -1
drivers/scsi/ufs/ufs-mediatek.c
··· 911 911 if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc) 912 912 return; 913 913 914 - if (lpm & !hba->vreg_info.vcc->enabled) 914 + if (lpm && !hba->vreg_info.vcc->enabled) 915 915 regulator_set_mode(hba->vreg_info.vccq2->reg, 916 916 REGULATOR_MODE_IDLE); 917 917 else if (!lpm)
+10
drivers/scsi/ufs/ufs-qcom.c
··· 253 253 { 254 254 int ret = 0; 255 255 struct ufs_qcom_host *host = ufshcd_get_variant(hba); 256 + bool reenable_intr = false; 256 257 257 258 if (!host->core_reset) { 258 259 dev_warn(hba->dev, "%s: reset control not set\n", __func__); 259 260 goto out; 260 261 } 262 + 263 + reenable_intr = hba->is_irq_enabled; 264 + disable_irq(hba->irq); 265 + hba->is_irq_enabled = false; 261 266 262 267 ret = reset_control_assert(host->core_reset); 263 268 if (ret) { ··· 284 279 __func__, ret); 285 280 286 281 usleep_range(1000, 1100); 282 + 283 + if (reenable_intr) { 284 + enable_irq(hba->irq); 285 + hba->is_irq_enabled = true; 286 + } 287 287 288 288 out: 289 289 return ret;
+13 -28
drivers/scsi/ufs/ufshcd.c
··· 94 94 16, 4, buf, __len, false); \ 95 95 } while (0) 96 96 97 - static bool early_suspend; 98 - 99 97 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, 100 98 const char *prefix) 101 99 { ··· 1524 1526 { 1525 1527 struct ufs_hba *hba = dev_get_drvdata(dev); 1526 1528 1527 - return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_enabled); 1529 + return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_enabled); 1528 1530 } 1529 1531 1530 1532 static ssize_t ufshcd_clkscale_enable_store(struct device *dev, ··· 4974 4976 * UFS device needs urgent BKOPs. 4975 4977 */ 4976 4978 if (!hba->pm_op_in_progress && 4979 + !ufshcd_eh_in_progress(hba) && 4977 4980 ufshcd_is_exception_event(lrbp->ucd_rsp_ptr) && 4978 4981 schedule_work(&hba->eeh_work)) { 4979 4982 /* ··· 5776 5777 ufshcd_suspend_clkscaling(hba); 5777 5778 ufshcd_clk_scaling_allow(hba, false); 5778 5779 } 5780 + ufshcd_scsi_block_requests(hba); 5781 + /* Drain ufshcd_queuecommand() */ 5782 + down_write(&hba->clk_scaling_lock); 5783 + up_write(&hba->clk_scaling_lock); 5784 + cancel_work_sync(&hba->eeh_work); 5779 5785 } 5780 5786 5781 5787 static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) 5782 5788 { 5789 + ufshcd_scsi_unblock_requests(hba); 5783 5790 ufshcd_release(hba); 5784 5791 if (ufshcd_is_clkscaling_supported(hba)) 5785 5792 ufshcd_clk_scaling_suspend(hba, false); 5793 + ufshcd_clear_ua_wluns(hba); 5786 5794 pm_runtime_put(hba->dev); 5787 5795 } 5788 5796 ··· 5881 5875 spin_unlock_irqrestore(hba->host->host_lock, flags); 5882 5876 ufshcd_err_handling_prepare(hba); 5883 5877 spin_lock_irqsave(hba->host->host_lock, flags); 5884 - ufshcd_scsi_block_requests(hba); 5885 - hba->ufshcd_state = UFSHCD_STATE_RESET; 5878 + if (hba->ufshcd_state != UFSHCD_STATE_ERROR) 5879 + hba->ufshcd_state = UFSHCD_STATE_RESET; 5886 5880 5887 5881 /* Complete requests that have door-bell cleared by h/w */ 5888 5882 ufshcd_complete_requests(hba); ··· 6041 6035 } 6042 6036 ufshcd_clear_eh_in_progress(hba); 6043 6037 spin_unlock_irqrestore(hba->host->host_lock, flags); 6044 - ufshcd_scsi_unblock_requests(hba); 6045 6038 ufshcd_err_handling_unprepare(hba); 6046 6039 up(&hba->host_sem); 6047 - 6048 - if (!err && needs_reset) 6049 - ufshcd_clear_ua_wluns(hba); 6050 6040 } 6051 6041 6052 6042 /** ··· 7848 7846 unsigned long flags; 7849 7847 ktime_t start = ktime_get(); 7850 7848 7849 + hba->ufshcd_state = UFSHCD_STATE_RESET; 7850 + 7851 7851 ret = ufshcd_link_startup(hba); 7852 7852 if (ret) 7853 7853 goto out; ··· 8969 8965 int ret = 0; 8970 8966 ktime_t start = ktime_get(); 8971 8967 8972 - if (!hba) { 8973 - early_suspend = true; 8974 - return 0; 8975 - } 8976 - 8977 8968 down(&hba->host_sem); 8978 8969 8979 8970 if (!hba->is_powered) ··· 9020 9021 int ret = 0; 9021 9022 ktime_t start = ktime_get(); 9022 9023 9023 - if (!hba) 9024 - return -EINVAL; 9025 - 9026 - if (unlikely(early_suspend)) { 9027 - early_suspend = false; 9028 - down(&hba->host_sem); 9029 - } 9030 - 9031 9024 if (!hba->is_powered || pm_runtime_suspended(hba->dev)) 9032 9025 /* 9033 9026 * Let the runtime resume take care of resuming ··· 9051 9060 { 9052 9061 int ret = 0; 9053 9062 ktime_t start = ktime_get(); 9054 - 9055 - if (!hba) 9056 - return -EINVAL; 9057 9063 9058 9064 if (!hba->is_powered) 9059 9065 goto out; ··· 9089 9101 { 9090 9102 int ret = 0; 9091 9103 ktime_t start = ktime_get(); 9092 - 9093 - if (!hba) 9094 - return -EINVAL; 9095 9104 9096 9105 if (!hba->is_powered) 9097 9106 goto out;
-2
drivers/scsi/vmw_pvscsi.c
··· 17 17 * along with this program; if not, write to the Free Software 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 19 * 20 - * Maintained by: Jim Gill <jgill@vmware.com> 21 - * 22 20 */ 23 21 24 22 #include <linux/kernel.h>
-2
drivers/scsi/vmw_pvscsi.h
··· 17 17 * along with this program; if not, write to the Free Software 18 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 19 * 20 - * Maintained by: Jim Gill <jgill@vmware.com> 21 - * 22 20 */ 23 21 24 22 #ifndef _VMW_PVSCSI_H_
+8 -1
drivers/target/target_core_pscsi.c
··· 881 881 if (!bio) { 882 882 new_bio: 883 883 nr_vecs = bio_max_segs(nr_pages); 884 - nr_pages -= nr_vecs; 885 884 /* 886 885 * Calls bio_kmalloc() and sets bio->bi_end_io() 887 886 */ ··· 937 938 938 939 return 0; 939 940 fail: 941 + if (bio) 942 + bio_put(bio); 943 + while (req->bio) { 944 + bio = req->bio; 945 + req->bio = bio->bi_next; 946 + bio_put(bio); 947 + } 948 + req->biotail = NULL; 940 949 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 941 950 } 942 951
+1
include/scsi/scsi_transport_iscsi.h
··· 193 193 ISCSI_CONN_UP = 0, 194 194 ISCSI_CONN_DOWN, 195 195 ISCSI_CONN_FAILED, 196 + ISCSI_CONN_BOUND, 196 197 }; 197 198 198 199 struct iscsi_cls_conn {