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:
"A set of 17 fixes. Most of these are minor or trivial.

The one fix that may be serious is the isci one: the bug can cause hba
parameters to be set from uninitialized memory. I don't think it's
exploitable, but you never know"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: cxgb4i: add wait_for_completion()
scsi: qla1280: set 64bit coherent mask
scsi: ufs: Fix geometry descriptor size
scsi: megaraid_sas: Retry reads of outbound_intr_status reg
scsi: qedi: Add ep_state for login completion on un-reachable targets
scsi: ufs: Fix system suspend status
scsi: qla2xxx: Use correct number of vectors for online CPUs
scsi: hisi_sas: Set protection parameters prior to adding SCSI host
scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes
scsi: isci: initialize shost fully before calling scsi_add_host()
scsi: lpfc: lpfc_sli: Mark expected switch fall-throughs
scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start
scsi: core: Synchronize request queue PM status only on successful resume
scsi: pm80xx: reduce indentation
scsi: qla4xxx: check return code of qla4xxx_copy_from_fwddb_param
scsi: megaraid_sas: correct an info message
scsi: target/iscsi: fix error msg typo when create lio_qr_cache failed
scsi: sd: Fix cache_type_store()

+157 -86
+4 -5
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
··· 1144 1144 } 1145 1145 1146 1146 static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, 1147 - unsigned int tid, int pg_idx, bool reply) 1147 + unsigned int tid, int pg_idx) 1148 1148 { 1149 1149 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, 1150 1150 GFP_KERNEL); ··· 1160 1160 req = (struct cpl_set_tcb_field *)skb->head; 1161 1161 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 1162 1162 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 1163 - req->reply = V_NO_REPLY(reply ? 0 : 1); 1163 + req->reply = V_NO_REPLY(1); 1164 1164 req->cpu_idx = 0; 1165 1165 req->word = htons(31); 1166 1166 req->mask = cpu_to_be64(0xF0000000); ··· 1177 1177 * @tid: connection id 1178 1178 * @hcrc: header digest enabled 1179 1179 * @dcrc: data digest enabled 1180 - * @reply: request reply from h/w 1181 1180 * set up the iscsi digest settings for a connection identified by tid 1182 1181 */ 1183 1182 static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, 1184 - int hcrc, int dcrc, int reply) 1183 + int hcrc, int dcrc) 1185 1184 { 1186 1185 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, 1187 1186 GFP_KERNEL); ··· 1196 1197 req = (struct cpl_set_tcb_field *)skb->head; 1197 1198 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 1198 1199 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 1199 - req->reply = V_NO_REPLY(reply ? 0 : 1); 1200 + req->reply = V_NO_REPLY(1); 1200 1201 req->cpu_idx = 0; 1201 1202 req->word = htons(31); 1202 1203 req->mask = cpu_to_be64(0x0F000000);
+20 -8
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
··· 1548 1548 struct cxgbi_sock *csk; 1549 1549 1550 1550 csk = lookup_tid(t, tid); 1551 - if (!csk) 1551 + if (!csk) { 1552 1552 pr_err("can't find conn. for tid %u.\n", tid); 1553 + return; 1554 + } 1553 1555 1554 1556 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 1555 1557 "csk 0x%p,%u,%lx,%u, status 0x%x.\n", 1556 1558 csk, csk->state, csk->flags, csk->tid, rpl->status); 1557 1559 1558 - if (rpl->status != CPL_ERR_NONE) 1560 + if (rpl->status != CPL_ERR_NONE) { 1559 1561 pr_err("csk 0x%p,%u, SET_TCB_RPL status %u.\n", 1560 1562 csk, tid, rpl->status); 1563 + csk->err = -EINVAL; 1564 + } 1565 + 1566 + complete(&csk->cmpl); 1561 1567 1562 1568 __kfree_skb(skb); 1563 1569 } ··· 1989 1983 } 1990 1984 1991 1985 static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid, 1992 - int pg_idx, bool reply) 1986 + int pg_idx) 1993 1987 { 1994 1988 struct sk_buff *skb; 1995 1989 struct cpl_set_tcb_field *req; ··· 2005 1999 req = (struct cpl_set_tcb_field *)skb->head; 2006 2000 INIT_TP_WR(req, csk->tid); 2007 2001 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); 2008 - req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); 2002 + req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid)); 2009 2003 req->word_cookie = htons(0); 2010 2004 req->mask = cpu_to_be64(0x3 << 8); 2011 2005 req->val = cpu_to_be64(pg_idx << 8); ··· 2014 2008 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 2015 2009 "csk 0x%p, tid 0x%x, pg_idx %u.\n", csk, csk->tid, pg_idx); 2016 2010 2011 + reinit_completion(&csk->cmpl); 2017 2012 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); 2018 - return 0; 2013 + wait_for_completion(&csk->cmpl); 2014 + 2015 + return csk->err; 2019 2016 } 2020 2017 2021 2018 static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, 2022 - int hcrc, int dcrc, int reply) 2019 + int hcrc, int dcrc) 2023 2020 { 2024 2021 struct sk_buff *skb; 2025 2022 struct cpl_set_tcb_field *req; ··· 2040 2031 req = (struct cpl_set_tcb_field *)skb->head; 2041 2032 INIT_TP_WR(req, tid); 2042 2033 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 2043 - req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); 2034 + req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid)); 2044 2035 req->word_cookie = htons(0); 2045 2036 req->mask = cpu_to_be64(0x3 << 4); 2046 2037 req->val = cpu_to_be64(((hcrc ? ULP_CRC_HEADER : 0) | ··· 2050 2041 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 2051 2042 "csk 0x%p, tid 0x%x, crc %d,%d.\n", csk, csk->tid, hcrc, dcrc); 2052 2043 2044 + reinit_completion(&csk->cmpl); 2053 2045 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); 2054 - return 0; 2046 + wait_for_completion(&csk->cmpl); 2047 + 2048 + return csk->err; 2055 2049 } 2056 2050 2057 2051 static struct cxgbi_ppm *cdev2ppm(struct cxgbi_device *cdev)
+4 -3
drivers/scsi/cxgbi/libcxgbi.c
··· 573 573 skb_queue_head_init(&csk->receive_queue); 574 574 skb_queue_head_init(&csk->write_queue); 575 575 timer_setup(&csk->retry_timer, NULL, 0); 576 + init_completion(&csk->cmpl); 576 577 rwlock_init(&csk->callback_lock); 577 578 csk->cdev = cdev; 578 579 csk->flags = 0; ··· 2252 2251 if (!err && conn->hdrdgst_en) 2253 2252 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, 2254 2253 conn->hdrdgst_en, 2255 - conn->datadgst_en, 0); 2254 + conn->datadgst_en); 2256 2255 break; 2257 2256 case ISCSI_PARAM_DATADGST_EN: 2258 2257 err = iscsi_set_param(cls_conn, param, buf, buflen); 2259 2258 if (!err && conn->datadgst_en) 2260 2259 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, 2261 2260 conn->hdrdgst_en, 2262 - conn->datadgst_en, 0); 2261 + conn->datadgst_en); 2263 2262 break; 2264 2263 case ISCSI_PARAM_MAX_R2T: 2265 2264 return iscsi_tcp_set_max_r2t(conn, buf); ··· 2385 2384 2386 2385 ppm = csk->cdev->cdev2ppm(csk->cdev); 2387 2386 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, 2388 - ppm->tformat.pgsz_idx_dflt, 0); 2387 + ppm->tformat.pgsz_idx_dflt); 2389 2388 if (err < 0) 2390 2389 return err; 2391 2390
+3 -2
drivers/scsi/cxgbi/libcxgbi.h
··· 149 149 struct sk_buff_head receive_queue; 150 150 struct sk_buff_head write_queue; 151 151 struct timer_list retry_timer; 152 + struct completion cmpl; 152 153 int err; 153 154 rwlock_t callback_lock; 154 155 void *user_data; ··· 491 490 struct cxgbi_ppm *, 492 491 struct cxgbi_task_tag_info *); 493 492 int (*csk_ddp_setup_digest)(struct cxgbi_sock *, 494 - unsigned int, int, int, int); 493 + unsigned int, int, int); 495 494 int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *, 496 - unsigned int, int, bool); 495 + unsigned int, int); 497 496 498 497 void (*csk_release_offload_resources)(struct cxgbi_sock *); 499 498 int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *);
+6 -6
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 2507 2507 sha->sas_port[i] = &hisi_hba->port[i].sas_port; 2508 2508 } 2509 2509 2510 + if (hisi_hba->prot_mask) { 2511 + dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n", 2512 + prot_mask); 2513 + scsi_host_set_prot(hisi_hba->shost, prot_mask); 2514 + } 2515 + 2510 2516 rc = scsi_add_host(shost, dev); 2511 2517 if (rc) 2512 2518 goto err_out_ha; ··· 2524 2518 rc = hisi_hba->hw->hw_init(hisi_hba); 2525 2519 if (rc) 2526 2520 goto err_out_register_ha; 2527 - 2528 - if (hisi_hba->prot_mask) { 2529 - dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n", 2530 - prot_mask); 2531 - scsi_host_set_prot(hisi_hba->shost, prot_mask); 2532 - } 2533 2521 2534 2522 scsi_scan_host(shost); 2535 2523
+7 -7
drivers/scsi/isci/init.c
··· 576 576 shost->max_lun = ~0; 577 577 shost->max_cmd_len = MAX_COMMAND_SIZE; 578 578 579 + /* turn on DIF support */ 580 + scsi_host_set_prot(shost, 581 + SHOST_DIF_TYPE1_PROTECTION | 582 + SHOST_DIF_TYPE2_PROTECTION | 583 + SHOST_DIF_TYPE3_PROTECTION); 584 + scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); 585 + 579 586 err = scsi_add_host(shost, &pdev->dev); 580 587 if (err) 581 588 goto err_shost; ··· 670 663 goto err_host_alloc; 671 664 } 672 665 pci_info->hosts[i] = h; 673 - 674 - /* turn on DIF support */ 675 - scsi_host_set_prot(to_shost(h), 676 - SHOST_DIF_TYPE1_PROTECTION | 677 - SHOST_DIF_TYPE2_PROTECTION | 678 - SHOST_DIF_TYPE3_PROTECTION); 679 - scsi_host_set_guard(to_shost(h), SHOST_DIX_GUARD_CRC); 680 666 } 681 667 682 668 err = isci_setup_interrupts(pdev);
+11 -9
drivers/scsi/lpfc/lpfc_sli.c
··· 9407 9407 cmnd = CMD_XMIT_SEQUENCE64_CR; 9408 9408 if (phba->link_flag & LS_LOOPBACK_MODE) 9409 9409 bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1); 9410 + /* fall through */ 9410 9411 case CMD_XMIT_SEQUENCE64_CR: 9411 9412 /* word3 iocb=io_tag32 wqe=reserved */ 9412 9413 wqe->xmit_sequence.rsvd3 = 0; ··· 13529 13528 case FC_STATUS_RQ_BUF_LEN_EXCEEDED: 13530 13529 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 13531 13530 "2537 Receive Frame Truncated!!\n"); 13531 + /* fall through */ 13532 13532 case FC_STATUS_RQ_SUCCESS: 13533 13533 spin_lock_irqsave(&phba->hbalock, iflags); 13534 13534 lpfc_sli4_rq_release(hrq, drq); ··· 13939 13937 case FC_STATUS_RQ_BUF_LEN_EXCEEDED: 13940 13938 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 13941 13939 "6126 Receive Frame Truncated!!\n"); 13942 - /* Drop thru */ 13940 + /* fall through */ 13943 13941 case FC_STATUS_RQ_SUCCESS: 13944 13942 spin_lock_irqsave(&phba->hbalock, iflags); 13945 13943 lpfc_sli4_rq_release(hrq, drq); ··· 14851 14849 eq->entry_count); 14852 14850 if (eq->entry_count < 256) 14853 14851 return -EINVAL; 14854 - /* otherwise default to smallest count (drop through) */ 14852 + /* fall through - otherwise default to smallest count */ 14855 14853 case 256: 14856 14854 bf_set(lpfc_eq_context_count, &eq_create->u.request.context, 14857 14855 LPFC_EQ_CNT_256); ··· 14982 14980 LPFC_CQ_CNT_WORD7); 14983 14981 break; 14984 14982 } 14985 - /* Fall Thru */ 14983 + /* fall through */ 14986 14984 default: 14987 14985 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 14988 14986 "0361 Unsupported CQ count: " ··· 14993 14991 status = -EINVAL; 14994 14992 goto out; 14995 14993 } 14996 - /* otherwise default to smallest count (drop through) */ 14994 + /* fall through - otherwise default to smallest count */ 14997 14995 case 256: 14998 14996 bf_set(lpfc_cq_context_count, &cq_create->u.request.context, 14999 14997 LPFC_CQ_CNT_256); ··· 15153 15151 LPFC_CQ_CNT_WORD7); 15154 15152 break; 15155 15153 } 15156 - /* Fall Thru */ 15154 + /* fall through */ 15157 15155 default: 15158 15156 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 15159 15157 "3118 Bad CQ count. (%d)\n", ··· 15162 15160 status = -EINVAL; 15163 15161 goto out; 15164 15162 } 15165 - /* otherwise default to smallest (drop thru) */ 15163 + /* fall through - otherwise default to smallest */ 15166 15164 case 256: 15167 15165 bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 15168 15166 &cq_set->u.request, LPFC_CQ_CNT_256); ··· 15434 15432 status = -EINVAL; 15435 15433 goto out; 15436 15434 } 15437 - /* otherwise default to smallest count (drop through) */ 15435 + /* fall through - otherwise default to smallest count */ 15438 15436 case 16: 15439 15437 bf_set(lpfc_mq_context_ring_size, 15440 15438 &mq_create_ext->u.request.context, ··· 15853 15851 status = -EINVAL; 15854 15852 goto out; 15855 15853 } 15856 - /* otherwise default to smallest count (drop through) */ 15854 + /* fall through - otherwise default to smallest count */ 15857 15855 case 512: 15858 15856 bf_set(lpfc_rq_context_rqe_count, 15859 15857 &rq_create->u.request.context, ··· 15990 15988 status = -EINVAL; 15991 15989 goto out; 15992 15990 } 15993 - /* otherwise default to smallest count (drop through) */ 15991 + /* fall through - otherwise default to smallest count */ 15994 15992 case 512: 15995 15993 bf_set(lpfc_rq_context_rqe_count, 15996 15994 &rq_create->u.request.context,
+1 -1
drivers/scsi/megaraid/megaraid_sas_base.c
··· 6236 6236 instance->consistent_mask_64bit = true; 6237 6237 6238 6238 dev_info(&pdev->dev, "%s bit DMA mask and %s bit consistent mask\n", 6239 - ((*pdev->dev.dma_mask == DMA_BIT_MASK(64)) ? "63" : "32"), 6239 + ((*pdev->dev.dma_mask == DMA_BIT_MASK(63)) ? "63" : "32"), 6240 6240 (instance->consistent_mask_64bit ? "63" : "32")); 6241 6241 6242 6242 return 0;
+2 -1
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 175 175 /* 176 176 * Check if it is our interrupt 177 177 */ 178 - status = readl(&regs->outbound_intr_status); 178 + status = megasas_readl(instance, 179 + &regs->outbound_intr_status); 179 180 180 181 if (status & 1) { 181 182 writel(status, &regs->outbound_intr_status);
+1 -1
drivers/scsi/pm8001/pm8001_sas.c
··· 657 657 if (dev->dev_type == SAS_SATA_DEV) { 658 658 pm8001_device->attached_phy = 659 659 dev->rphy->identify.phy_identifier; 660 - flag = 1; /* directly sata*/ 660 + flag = 1; /* directly sata */ 661 661 } 662 662 } /*register this device to HBA*/ 663 663 PM8001_DISC_DBG(pm8001_ha, pm8001_printk("Found device\n"));
+3
drivers/scsi/qedi/qedi_iscsi.c
··· 953 953 954 954 qedi_ep = ep->dd_data; 955 955 if (qedi_ep->state == EP_STATE_IDLE || 956 + qedi_ep->state == EP_STATE_OFLDCONN_NONE || 956 957 qedi_ep->state == EP_STATE_OFLDCONN_FAILED) 957 958 return -1; 958 959 ··· 1036 1035 1037 1036 switch (qedi_ep->state) { 1038 1037 case EP_STATE_OFLDCONN_START: 1038 + case EP_STATE_OFLDCONN_NONE: 1039 1039 goto ep_release_conn; 1040 1040 case EP_STATE_OFLDCONN_FAILED: 1041 1041 break; ··· 1227 1225 1228 1226 if (!is_valid_ether_addr(&path_data->mac_addr[0])) { 1229 1227 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n"); 1228 + qedi_ep->state = EP_STATE_OFLDCONN_NONE; 1230 1229 ret = -EIO; 1231 1230 goto set_path_exit; 1232 1231 }
+1
drivers/scsi/qedi/qedi_iscsi.h
··· 59 59 EP_STATE_OFLDCONN_FAILED = 0x2000, 60 60 EP_STATE_CONNECT_FAILED = 0x4000, 61 61 EP_STATE_DISCONN_TIMEDOUT = 0x8000, 62 + EP_STATE_OFLDCONN_NONE = 0x10000, 62 63 }; 63 64 64 65 struct qedi_conn;
+1 -1
drivers/scsi/qla1280.c
··· 4248 4248 ha->devnum = devnum; /* specifies microcode load address */ 4249 4249 4250 4250 #ifdef QLA_64BIT_PTR 4251 - if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { 4251 + if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) { 4252 4252 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { 4253 4253 printk(KERN_WARNING "scsi(%li): Unable to set a " 4254 4254 "suitable DMA mask - aborting\n", ha->host_no);
+2
drivers/scsi/qla2xxx/qla_def.h
··· 4394 4394 uint16_t n2n_id; 4395 4395 struct list_head gpnid_list; 4396 4396 struct fab_scan scan; 4397 + 4398 + unsigned int irq_offset; 4397 4399 } scsi_qla_host_t; 4398 4400 4399 4401 struct qla27xx_image_status {
+1
drivers/scsi/qla2xxx/qla_isr.c
··· 3446 3446 "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs); 3447 3447 } 3448 3448 } 3449 + vha->irq_offset = desc.pre_vectors; 3449 3450 ha->msix_entries = kcalloc(ha->msix_count, 3450 3451 sizeof(struct qla_msix_entry), 3451 3452 GFP_KERNEL);
+1 -1
drivers/scsi/qla2xxx/qla_os.c
··· 6939 6939 if (USER_CTRL_IRQ(vha->hw)) 6940 6940 rc = blk_mq_map_queues(qmap); 6941 6941 else 6942 - rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, 0); 6942 + rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); 6943 6943 return rc; 6944 6944 } 6945 6945
+2
drivers/scsi/qla4xxx/ql4_os.c
··· 7232 7232 7233 7233 rc = qla4xxx_copy_from_fwddb_param(fnode_sess, fnode_conn, 7234 7234 fw_ddb_entry); 7235 + if (rc) 7236 + goto free_sess; 7235 7237 7236 7238 ql4_printk(KERN_INFO, ha, "%s: sysfs entry %s created\n", 7237 7239 __func__, fnode_sess->dev.kobj.name);
+15 -11
drivers/scsi/scsi_pm.c
··· 80 80 81 81 if (err == 0) { 82 82 pm_runtime_disable(dev); 83 - pm_runtime_set_active(dev); 83 + err = pm_runtime_set_active(dev); 84 84 pm_runtime_enable(dev); 85 + 86 + /* 87 + * Forcibly set runtime PM status of request queue to "active" 88 + * to make sure we can again get requests from the queue 89 + * (see also blk_pm_peek_request()). 90 + * 91 + * The resume hook will correct runtime PM status of the disk. 92 + */ 93 + if (!err && scsi_is_sdev_device(dev)) { 94 + struct scsi_device *sdev = to_scsi_device(dev); 95 + 96 + if (sdev->request_queue->dev) 97 + blk_set_runtime_active(sdev->request_queue); 98 + } 85 99 } 86 100 87 101 return err; ··· 153 139 fn = async_sdev_restore; 154 140 else 155 141 fn = NULL; 156 - 157 - /* 158 - * Forcibly set runtime PM status of request queue to "active" to 159 - * make sure we can again get requests from the queue (see also 160 - * blk_pm_peek_request()). 161 - * 162 - * The resume hook will correct runtime PM status of the disk. 163 - */ 164 - if (scsi_is_sdev_device(dev) && pm_runtime_suspended(dev)) 165 - blk_set_runtime_active(to_scsi_device(dev)->request_queue); 166 142 167 143 if (fn) { 168 144 async_schedule_domain(fn, dev, &scsi_sd_pm_domain);
+6
drivers/scsi/sd.c
··· 206 206 sp = buffer_data[0] & 0x80 ? 1 : 0; 207 207 buffer_data[0] &= ~0x80; 208 208 209 + /* 210 + * Ensure WP, DPOFUA, and RESERVED fields are cleared in 211 + * received mode parameter buffer before doing MODE SELECT. 212 + */ 213 + data.device_specific = 0; 214 + 209 215 if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT, 210 216 SD_MAX_RETRIES, &data, &sshdr)) { 211 217 if (scsi_sense_valid(&sshdr))
+1 -1
drivers/scsi/smartpqi/smartpqi_init.c
··· 323 323 static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info, 324 324 struct pqi_scsi_dev *device) 325 325 { 326 - return device->in_remove & !ctrl_info->in_shutdown; 326 + return device->in_remove && !ctrl_info->in_shutdown; 327 327 } 328 328 329 329 static inline void pqi_schedule_rescan_worker_with_delay(
+1 -1
drivers/scsi/ufs/ufs.h
··· 195 195 QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90, 196 196 QUERY_DESC_UNIT_DEF_SIZE = 0x23, 197 197 QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06, 198 - QUERY_DESC_GEOMETRY_DEF_SIZE = 0x44, 198 + QUERY_DESC_GEOMETRY_DEF_SIZE = 0x48, 199 199 QUERY_DESC_POWER_DEF_SIZE = 0x62, 200 200 QUERY_DESC_HEALTH_DEF_SIZE = 0x25, 201 201 };
+2
drivers/scsi/ufs/ufshcd.c
··· 8001 8001 trace_ufshcd_system_resume(dev_name(hba->dev), ret, 8002 8002 ktime_to_us(ktime_sub(ktime_get(), start)), 8003 8003 hba->curr_dev_pwr_mode, hba->uic_link_state); 8004 + if (!ret) 8005 + hba->is_sys_suspended = false; 8004 8006 return ret; 8005 8007 } 8006 8008 EXPORT_SYMBOL(ufshcd_system_resume);
+1 -1
drivers/target/iscsi/iscsi_target.c
··· 714 714 sizeof(struct iscsi_queue_req), 715 715 __alignof__(struct iscsi_queue_req), 0, NULL); 716 716 if (!lio_qr_cache) { 717 - pr_err("nable to kmem_cache_create() for" 717 + pr_err("Unable to kmem_cache_create() for" 718 718 " lio_qr_cache\n"); 719 719 goto bitmap_out; 720 720 }
+61 -27
drivers/target/target_core_user.c
··· 148 148 size_t ring_size; 149 149 150 150 struct mutex cmdr_lock; 151 - struct list_head cmdr_queue; 151 + struct list_head qfull_queue; 152 152 153 153 uint32_t dbi_max; 154 154 uint32_t dbi_thresh; ··· 159 159 160 160 struct timer_list cmd_timer; 161 161 unsigned int cmd_time_out; 162 + struct list_head inflight_queue; 162 163 163 164 struct timer_list qfull_timer; 164 165 int qfull_time_out; ··· 180 179 struct tcmu_cmd { 181 180 struct se_cmd *se_cmd; 182 181 struct tcmu_dev *tcmu_dev; 183 - struct list_head cmdr_queue_entry; 182 + struct list_head queue_entry; 184 183 185 184 uint16_t cmd_id; 186 185 ··· 193 192 unsigned long deadline; 194 193 195 194 #define TCMU_CMD_BIT_EXPIRED 0 195 + #define TCMU_CMD_BIT_INFLIGHT 1 196 196 unsigned long flags; 197 197 }; 198 198 /* ··· 588 586 if (!tcmu_cmd) 589 587 return NULL; 590 588 591 - INIT_LIST_HEAD(&tcmu_cmd->cmdr_queue_entry); 589 + INIT_LIST_HEAD(&tcmu_cmd->queue_entry); 592 590 tcmu_cmd->se_cmd = se_cmd; 593 591 tcmu_cmd->tcmu_dev = udev; 594 592 ··· 917 915 return 0; 918 916 919 917 tcmu_cmd->deadline = round_jiffies_up(jiffies + msecs_to_jiffies(tmo)); 920 - mod_timer(timer, tcmu_cmd->deadline); 918 + if (!timer_pending(timer)) 919 + mod_timer(timer, tcmu_cmd->deadline); 920 + 921 921 return 0; 922 922 } 923 923 924 - static int add_to_cmdr_queue(struct tcmu_cmd *tcmu_cmd) 924 + static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) 925 925 { 926 926 struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; 927 927 unsigned int tmo; ··· 946 942 if (ret) 947 943 return ret; 948 944 949 - list_add_tail(&tcmu_cmd->cmdr_queue_entry, &udev->cmdr_queue); 945 + list_add_tail(&tcmu_cmd->queue_entry, &udev->qfull_queue); 950 946 pr_debug("adding cmd %u on dev %s to ring space wait queue\n", 951 947 tcmu_cmd->cmd_id, udev->name); 952 948 return 0; ··· 1003 999 base_command_size = tcmu_cmd_get_base_cmd_size(tcmu_cmd->dbi_cnt); 1004 1000 command_size = tcmu_cmd_get_cmd_size(tcmu_cmd, base_command_size); 1005 1001 1006 - if (!list_empty(&udev->cmdr_queue)) 1002 + if (!list_empty(&udev->qfull_queue)) 1007 1003 goto queue; 1008 1004 1009 1005 mb = udev->mb_addr; ··· 1100 1096 UPDATE_HEAD(mb->cmd_head, command_size, udev->cmdr_size); 1101 1097 tcmu_flush_dcache_range(mb, sizeof(*mb)); 1102 1098 1099 + list_add_tail(&tcmu_cmd->queue_entry, &udev->inflight_queue); 1100 + set_bit(TCMU_CMD_BIT_INFLIGHT, &tcmu_cmd->flags); 1101 + 1103 1102 /* TODO: only if FLUSH and FUA? */ 1104 1103 uio_event_notify(&udev->uio_info); 1105 1104 1106 1105 return 0; 1107 1106 1108 1107 queue: 1109 - if (add_to_cmdr_queue(tcmu_cmd)) { 1108 + if (add_to_qfull_queue(tcmu_cmd)) { 1110 1109 *scsi_err = TCM_OUT_OF_RESOURCES; 1111 1110 return -1; 1112 1111 } ··· 1151 1144 */ 1152 1145 if (test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) 1153 1146 goto out; 1147 + 1148 + list_del_init(&cmd->queue_entry); 1154 1149 1155 1150 tcmu_cmd_reset_dbi_cur(cmd); 1156 1151 ··· 1203 1194 tcmu_free_cmd(cmd); 1204 1195 } 1205 1196 1197 + static void tcmu_set_next_deadline(struct list_head *queue, 1198 + struct timer_list *timer) 1199 + { 1200 + struct tcmu_cmd *tcmu_cmd, *tmp_cmd; 1201 + unsigned long deadline = 0; 1202 + 1203 + list_for_each_entry_safe(tcmu_cmd, tmp_cmd, queue, queue_entry) { 1204 + if (!time_after(jiffies, tcmu_cmd->deadline)) { 1205 + deadline = tcmu_cmd->deadline; 1206 + break; 1207 + } 1208 + } 1209 + 1210 + if (deadline) 1211 + mod_timer(timer, deadline); 1212 + else 1213 + del_timer(timer); 1214 + } 1215 + 1206 1216 static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) 1207 1217 { 1208 1218 struct tcmu_mailbox *mb; 1219 + struct tcmu_cmd *cmd; 1209 1220 int handled = 0; 1210 1221 1211 1222 if (test_bit(TCMU_DEV_BIT_BROKEN, &udev->flags)) { ··· 1239 1210 while (udev->cmdr_last_cleaned != READ_ONCE(mb->cmd_tail)) { 1240 1211 1241 1212 struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned; 1242 - struct tcmu_cmd *cmd; 1243 1213 1244 1214 tcmu_flush_dcache_range(entry, sizeof(*entry)); 1245 1215 ··· 1271 1243 /* no more pending commands */ 1272 1244 del_timer(&udev->cmd_timer); 1273 1245 1274 - if (list_empty(&udev->cmdr_queue)) { 1246 + if (list_empty(&udev->qfull_queue)) { 1275 1247 /* 1276 1248 * no more pending or waiting commands so try to 1277 1249 * reclaim blocks if needed. ··· 1280 1252 tcmu_global_max_blocks) 1281 1253 schedule_delayed_work(&tcmu_unmap_work, 0); 1282 1254 } 1255 + } else if (udev->cmd_time_out) { 1256 + tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); 1283 1257 } 1284 1258 1285 1259 return handled; ··· 1301 1271 if (!time_after(jiffies, cmd->deadline)) 1302 1272 return 0; 1303 1273 1304 - is_running = list_empty(&cmd->cmdr_queue_entry); 1274 + is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags); 1305 1275 se_cmd = cmd->se_cmd; 1306 1276 1307 1277 if (is_running) { ··· 1318 1288 */ 1319 1289 scsi_status = SAM_STAT_CHECK_CONDITION; 1320 1290 } else { 1321 - list_del_init(&cmd->cmdr_queue_entry); 1322 - 1323 1291 idr_remove(&udev->commands, id); 1324 1292 tcmu_free_cmd(cmd); 1325 1293 scsi_status = SAM_STAT_TASK_SET_FULL; 1326 1294 } 1295 + list_del_init(&cmd->queue_entry); 1327 1296 1328 1297 pr_debug("Timing out cmd %u on dev %s that is %s.\n", 1329 1298 id, udev->name, is_running ? "inflight" : "queued"); ··· 1401 1372 1402 1373 INIT_LIST_HEAD(&udev->node); 1403 1374 INIT_LIST_HEAD(&udev->timedout_entry); 1404 - INIT_LIST_HEAD(&udev->cmdr_queue); 1375 + INIT_LIST_HEAD(&udev->qfull_queue); 1376 + INIT_LIST_HEAD(&udev->inflight_queue); 1405 1377 idr_init(&udev->commands); 1406 1378 1407 1379 timer_setup(&udev->qfull_timer, tcmu_qfull_timedout, 0); ··· 1413 1383 return &udev->se_dev; 1414 1384 } 1415 1385 1416 - static bool run_cmdr_queue(struct tcmu_dev *udev, bool fail) 1386 + static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) 1417 1387 { 1418 1388 struct tcmu_cmd *tcmu_cmd, *tmp_cmd; 1419 1389 LIST_HEAD(cmds); ··· 1421 1391 sense_reason_t scsi_ret; 1422 1392 int ret; 1423 1393 1424 - if (list_empty(&udev->cmdr_queue)) 1394 + if (list_empty(&udev->qfull_queue)) 1425 1395 return true; 1426 1396 1427 1397 pr_debug("running %s's cmdr queue forcefail %d\n", udev->name, fail); 1428 1398 1429 - list_splice_init(&udev->cmdr_queue, &cmds); 1399 + list_splice_init(&udev->qfull_queue, &cmds); 1430 1400 1431 - list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, cmdr_queue_entry) { 1432 - list_del_init(&tcmu_cmd->cmdr_queue_entry); 1401 + list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, queue_entry) { 1402 + list_del_init(&tcmu_cmd->queue_entry); 1433 1403 1434 1404 pr_debug("removing cmd %u on dev %s from queue\n", 1435 1405 tcmu_cmd->cmd_id, udev->name); ··· 1467 1437 * cmd was requeued, so just put all cmds back in 1468 1438 * the queue 1469 1439 */ 1470 - list_splice_tail(&cmds, &udev->cmdr_queue); 1440 + list_splice_tail(&cmds, &udev->qfull_queue); 1471 1441 drained = false; 1472 - goto done; 1442 + break; 1473 1443 } 1474 1444 } 1475 - if (list_empty(&udev->cmdr_queue)) 1476 - del_timer(&udev->qfull_timer); 1477 - done: 1445 + 1446 + tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); 1478 1447 return drained; 1479 1448 } 1480 1449 ··· 1483 1454 1484 1455 mutex_lock(&udev->cmdr_lock); 1485 1456 tcmu_handle_completions(udev); 1486 - run_cmdr_queue(udev, false); 1457 + run_qfull_queue(udev, false); 1487 1458 mutex_unlock(&udev->cmdr_lock); 1488 1459 1489 1460 return 0; ··· 2011 1982 /* complete IO that has executed successfully */ 2012 1983 tcmu_handle_completions(udev); 2013 1984 /* fail IO waiting to be queued */ 2014 - run_cmdr_queue(udev, true); 1985 + run_qfull_queue(udev, true); 2015 1986 2016 1987 unlock: 2017 1988 mutex_unlock(&udev->cmdr_lock); ··· 2026 1997 mutex_lock(&udev->cmdr_lock); 2027 1998 2028 1999 idr_for_each_entry(&udev->commands, cmd, i) { 2029 - if (!list_empty(&cmd->cmdr_queue_entry)) 2000 + if (!test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags)) 2030 2001 continue; 2031 2002 2032 2003 pr_debug("removing cmd %u on dev %s from ring (is expired %d)\n", ··· 2035 2006 2036 2007 idr_remove(&udev->commands, i); 2037 2008 if (!test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) { 2009 + list_del_init(&cmd->queue_entry); 2038 2010 if (err_level == 1) { 2039 2011 /* 2040 2012 * Userspace was not able to start the ··· 2696 2666 2697 2667 mutex_lock(&udev->cmdr_lock); 2698 2668 idr_for_each(&udev->commands, tcmu_check_expired_cmd, NULL); 2669 + 2670 + tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); 2671 + tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); 2672 + 2699 2673 mutex_unlock(&udev->cmdr_lock); 2700 2674 2701 2675 spin_lock_bh(&timed_out_udevs_lock);