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-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull more SCSI updates from James Bottomley:
"This is the set of patches which arrived too late to stabilise in
-next for the first pull.

It's really just an lpfc driver update and an assortment of minor
fixes, all in drivers. The only core update is to the zone block
device driver, which isn't the one most people use"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: lpfc: Update lpfc version to 12.8.0.3
scsi: lpfc: Fix LUN loss after cable pull
scsi: lpfc: Fix validation of bsg reply lengths
scsi: lpfc: Fix retry of PRLI when status indicates its unsupported
scsi: lpfc: Fix oops when unloading driver while running mds diags
scsi: lpfc: Fix RSCN timeout due to incorrect gidft counter
scsi: lpfc: Fix no message shown for lpfc_hdw_queue out of range value
scsi: lpfc: Fix FCoE speed reporting
scsi: lpfc: Add missing misc_deregister() for lpfc_init()
scsi: lpfc: nvmet: Avoid hang / use-after-free again when destroying targetport
scsi: scsi_transport_sas: Add spaces around binary operator "|"
scsi: sd_zbc: Improve zone revalidation
scsi: libfc: Free skb in fc_disc_gpn_id_resp() for valid cases
scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
scsi: target: Make iscsit_register_transport() return void

+165 -98
+1 -1
drivers/scsi/fcoe/fcoe_ctlr.c
··· 256 256 WARN_ON(!fcf_dev); 257 257 new->fcf_dev = NULL; 258 258 fcoe_fcf_device_delete(fcf_dev); 259 - kfree(new); 260 259 mutex_unlock(&cdev->lock); 261 260 } 261 + kfree(new); 262 262 } 263 263 264 264 /**
+9 -3
drivers/scsi/libfc/fc_disc.c
··· 581 581 582 582 if (PTR_ERR(fp) == -FC_EX_CLOSED) 583 583 goto out; 584 - if (IS_ERR(fp)) 585 - goto redisc; 584 + if (IS_ERR(fp)) { 585 + mutex_lock(&disc->disc_mutex); 586 + fc_disc_restart(disc); 587 + mutex_unlock(&disc->disc_mutex); 588 + goto out; 589 + } 586 590 587 591 cp = fc_frame_payload_get(fp, sizeof(*cp)); 588 592 if (!cp) ··· 613 609 new_rdata->disc_id = disc->disc_id; 614 610 fc_rport_login(new_rdata); 615 611 } 616 - goto out; 612 + goto free_fp; 617 613 } 618 614 rdata->disc_id = disc->disc_id; 619 615 mutex_unlock(&rdata->rp_mutex); ··· 630 626 fc_disc_restart(disc); 631 627 mutex_unlock(&disc->disc_mutex); 632 628 } 629 + free_fp: 630 + fc_frame_free(fp); 633 631 out: 634 632 kref_put(&rdata->kref, fc_rport_destroy); 635 633 if (!IS_ERR(fp))
+23 -3
drivers/scsi/lpfc/lpfc_attr.c
··· 6679 6679 } 6680 6680 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { 6681 6681 switch (phba->fc_linkspeed) { 6682 + case LPFC_ASYNC_LINK_SPEED_1GBPS: 6683 + fc_host_speed(shost) = FC_PORTSPEED_1GBIT; 6684 + break; 6682 6685 case LPFC_ASYNC_LINK_SPEED_10GBPS: 6683 6686 fc_host_speed(shost) = FC_PORTSPEED_10GBIT; 6687 + break; 6688 + case LPFC_ASYNC_LINK_SPEED_20GBPS: 6689 + fc_host_speed(shost) = FC_PORTSPEED_20GBIT; 6684 6690 break; 6685 6691 case LPFC_ASYNC_LINK_SPEED_25GBPS: 6686 6692 fc_host_speed(shost) = FC_PORTSPEED_25GBIT; ··· 7412 7406 void 7413 7407 lpfc_nvme_mod_param_dep(struct lpfc_hba *phba) 7414 7408 { 7415 - if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) 7409 + int logit = 0; 7410 + 7411 + if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { 7416 7412 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; 7417 - if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) 7413 + logit = 1; 7414 + } 7415 + if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { 7418 7416 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; 7419 - if (phba->cfg_irq_chann > phba->cfg_hdw_queue) 7417 + logit = 1; 7418 + } 7419 + if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { 7420 7420 phba->cfg_irq_chann = phba->cfg_hdw_queue; 7421 + logit = 1; 7422 + } 7423 + if (logit) 7424 + lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 7425 + "2006 Reducing Queues - CPU limitation: " 7426 + "IRQ %d HDWQ %d\n", 7427 + phba->cfg_irq_chann, 7428 + phba->cfg_hdw_queue); 7421 7429 7422 7430 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && 7423 7431 phba->nvmet_support) {
+8 -13
drivers/scsi/lpfc/lpfc_bsg.c
··· 2494 2494 diag_status_reply = (struct diag_status *) 2495 2495 bsg_reply->reply_data.vendor_reply.vendor_rsp; 2496 2496 2497 - if (job->reply_len < 2498 - sizeof(struct fc_bsg_request) + sizeof(struct diag_status)) { 2497 + if (job->reply_len < sizeof(*bsg_reply) + sizeof(*diag_status_reply)) { 2499 2498 lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC, 2500 2499 "3012 Received Run link diag test reply " 2501 2500 "below minimum size (%d): reply_len:%d\n", 2502 - (int)(sizeof(struct fc_bsg_request) + 2503 - sizeof(struct diag_status)), 2501 + (int)(sizeof(*bsg_reply) + 2502 + sizeof(*diag_status_reply)), 2504 2503 job->reply_len); 2505 2504 rc = -EINVAL; 2506 2505 goto job_error; ··· 3417 3418 event_reply = (struct get_mgmt_rev_reply *) 3418 3419 bsg_reply->reply_data.vendor_reply.vendor_rsp; 3419 3420 3420 - if (job->reply_len < 3421 - sizeof(struct fc_bsg_request) + sizeof(struct get_mgmt_rev_reply)) { 3421 + if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) { 3422 3422 lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC, 3423 3423 "2741 Received GET_DFC_REV reply below " 3424 3424 "minimum size\n"); ··· 5200 5202 goto no_dd_data; 5201 5203 } 5202 5204 5203 - if (job->reply_len < 5204 - sizeof(struct fc_bsg_request) + sizeof(struct menlo_response)) { 5205 + if (job->reply_len < sizeof(*bsg_reply) + 5206 + sizeof(struct menlo_response)) { 5205 5207 lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC, 5206 5208 "2785 Received MENLO_CMD reply below " 5207 5209 "minimum size\n"); ··· 5357 5359 forced_reply = (struct forced_link_speed_support_reply *) 5358 5360 bsg_reply->reply_data.vendor_reply.vendor_rsp; 5359 5361 5360 - if (job->reply_len < 5361 - sizeof(struct fc_bsg_request) + 5362 - sizeof(struct forced_link_speed_support_reply)) { 5362 + if (job->reply_len < sizeof(*bsg_reply) + sizeof(*forced_reply)) { 5363 5363 lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC, 5364 5364 "0049 Received FORCED_LINK_SPEED reply below " 5365 5365 "minimum size\n"); ··· 5711 5715 event_reply = (struct lpfc_trunk_info *) 5712 5716 bsg_reply->reply_data.vendor_reply.vendor_rsp; 5713 5717 5714 - if (job->reply_len < 5715 - sizeof(struct fc_bsg_request) + sizeof(struct lpfc_trunk_info)) { 5718 + if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) { 5716 5719 lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC, 5717 5720 "2728 Received GET TRUNK _INFO reply below " 5718 5721 "minimum size\n");
+16 -6
drivers/scsi/lpfc/lpfc_ct.c
··· 713 713 /* This is a GID_FT completing so the gidft_inp counter was 714 714 * incremented before the GID_FT was issued to the wire. 715 715 */ 716 - vport->gidft_inp--; 716 + if (vport->gidft_inp) 717 + vport->gidft_inp--; 717 718 718 719 /* 719 720 * Skip processing the NS response ··· 742 741 goto out; 743 742 744 743 /* CT command is being retried */ 745 - vport->gidft_inp--; 746 744 rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 747 745 vport->fc_ns_retry, type); 748 746 if (rc == 0) 749 747 goto out; 748 + else { /* Unable to send NS cmd */ 749 + if (vport->gidft_inp) 750 + vport->gidft_inp--; 751 + } 750 752 } 751 753 if (vport->fc_flag & FC_RSCN_MODE) 752 754 lpfc_els_flush_rscn(vport); ··· 829 825 (uint32_t) CTrsp->ReasonCode, 830 826 (uint32_t) CTrsp->Explanation); 831 827 } 832 - vport->gidft_inp--; 828 + if (vport->gidft_inp) 829 + vport->gidft_inp--; 833 830 } 834 831 835 832 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, ··· 923 918 /* This is a GID_PT completing so the gidft_inp counter was 924 919 * incremented before the GID_PT was issued to the wire. 925 920 */ 926 - vport->gidft_inp--; 921 + if (vport->gidft_inp) 922 + vport->gidft_inp--; 927 923 928 924 /* 929 925 * Skip processing the NS response ··· 948 942 vport->fc_ns_retry++; 949 943 950 944 /* CT command is being retried */ 951 - vport->gidft_inp--; 952 945 rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_PT, 953 946 vport->fc_ns_retry, GID_PT_N_PORT); 954 947 if (rc == 0) 955 948 goto out; 949 + else { /* Unable to send NS cmd */ 950 + if (vport->gidft_inp) 951 + vport->gidft_inp--; 952 + } 956 953 } 957 954 if (vport->fc_flag & FC_RSCN_MODE) 958 955 lpfc_els_flush_rscn(vport); ··· 1036 1027 (uint32_t)CTrsp->ReasonCode, 1037 1028 (uint32_t)CTrsp->Explanation); 1038 1029 } 1039 - vport->gidft_inp--; 1030 + if (vport->gidft_inp) 1031 + vport->gidft_inp--; 1040 1032 } 1041 1033 1042 1034 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+7 -3
drivers/scsi/lpfc/lpfc_els.c
··· 3937 3937 case LSRJT_UNABLE_TPC: 3938 3938 /* The driver has a VALID PLOGI but the rport has 3939 3939 * rejected the PRLI - can't do it now. Delay 3940 - * for 1 second and try again - don't care about 3941 - * the explanation. 3940 + * for 1 second and try again. 3941 + * 3942 + * However, if explanation is REQ_UNSUPPORTED there's 3943 + * no point to retry PRLI. 3942 3944 */ 3943 - if (cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) { 3945 + if ((cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) && 3946 + stat.un.b.lsRjtRsnCodeExp != 3947 + LSEXP_REQ_UNSUPPORTED) { 3944 3948 delay = 1000; 3945 3949 maxretry = lpfc_max_els_tries + 1; 3946 3950 retry = 1;
+20 -5
drivers/scsi/lpfc/lpfc_init.c
··· 4577 4577 struct lpfc_hba *phba = vport->phba; 4578 4578 4579 4579 fc_host_supported_speeds(shost) = 0; 4580 + /* 4581 + * Avoid reporting supported link speed for FCoE as it can't be 4582 + * controlled via FCoE. 4583 + */ 4584 + if (phba->hba_flag & HBA_FCOE_MODE) 4585 + return; 4586 + 4580 4587 if (phba->lmt & LMT_128Gb) 4581 4588 fc_host_supported_speeds(shost) |= FC_PORTSPEED_128GBIT; 4582 4589 if (phba->lmt & LMT_64Gb) ··· 4916 4909 break; 4917 4910 case LPFC_ASYNC_LINK_SPEED_40GBPS: 4918 4911 port_speed = 40000; 4912 + break; 4913 + case LPFC_ASYNC_LINK_SPEED_100GBPS: 4914 + port_speed = 100000; 4919 4915 break; 4920 4916 default: 4921 4917 port_speed = 0; ··· 8599 8589 "VPI(B:%d M:%d) " 8600 8590 "VFI(B:%d M:%d) " 8601 8591 "RPI(B:%d M:%d) " 8602 - "FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d\n", 8592 + "FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d lmt:x%x\n", 8603 8593 phba->sli4_hba.extents_in_use, 8604 8594 phba->sli4_hba.max_cfg_param.xri_base, 8605 8595 phba->sli4_hba.max_cfg_param.max_xri, ··· 8613 8603 phba->sli4_hba.max_cfg_param.max_eq, 8614 8604 phba->sli4_hba.max_cfg_param.max_cq, 8615 8605 phba->sli4_hba.max_cfg_param.max_wq, 8616 - phba->sli4_hba.max_cfg_param.max_rq); 8606 + phba->sli4_hba.max_cfg_param.max_rq, 8607 + phba->lmt); 8617 8608 8618 8609 /* 8619 8610 * Calculate queue resources based on how ··· 8637 8626 if ((phba->cfg_irq_chann > qmin) || 8638 8627 (phba->cfg_hdw_queue > qmin)) { 8639 8628 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 8640 - "2005 Reducing Queues: " 8629 + "2005 Reducing Queues - " 8630 + "FW resource limitation: " 8641 8631 "WQ %d CQ %d EQ %d: min %d: " 8642 8632 "IRQ %d HDWQ %d\n", 8643 8633 phba->sli4_hba.max_cfg_param.max_wq, ··· 14112 14100 printk(KERN_ERR "Could not register lpfcmgmt device, " 14113 14101 "misc_register returned with status %d", error); 14114 14102 14103 + error = -ENOMEM; 14115 14104 lpfc_transport_functions.vport_create = lpfc_vport_create; 14116 14105 lpfc_transport_functions.vport_delete = lpfc_vport_delete; 14117 14106 lpfc_transport_template = 14118 14107 fc_attach_transport(&lpfc_transport_functions); 14119 14108 if (lpfc_transport_template == NULL) 14120 - return -ENOMEM; 14109 + goto unregister; 14121 14110 lpfc_vport_transport_template = 14122 14111 fc_attach_transport(&lpfc_vport_transport_functions); 14123 14112 if (lpfc_vport_transport_template == NULL) { 14124 14113 fc_release_transport(lpfc_transport_template); 14125 - return -ENOMEM; 14114 + goto unregister; 14126 14115 } 14127 14116 lpfc_nvme_cmd_template(); 14128 14117 lpfc_nvmet_cmd_template(); ··· 14149 14136 cpuhp_failure: 14150 14137 fc_release_transport(lpfc_transport_template); 14151 14138 fc_release_transport(lpfc_vport_transport_template); 14139 + unregister: 14140 + misc_deregister(&lpfc_mgmt_dev); 14152 14141 14153 14142 return error; 14154 14143 }
+7 -1
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 1745 1745 } 1746 1746 } 1747 1747 1748 - if (ndlp->nlp_type & NLP_FCP_TARGET) { 1748 + if (ndlp->nlp_type & NLP_FCP_TARGET) 1749 + ndlp->nlp_fc4_type |= NLP_FC4_FCP; 1750 + 1751 + if (ndlp->nlp_type & NLP_NVME_TARGET) 1752 + ndlp->nlp_fc4_type |= NLP_FC4_NVME; 1753 + 1754 + if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) { 1749 1755 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 1750 1756 lpfc_nlp_set_state(vport, ndlp, NLP_STE_MAPPED_NODE); 1751 1757 } else {
+1 -1
drivers/scsi/lpfc/lpfc_nvmet.c
··· 2110 2110 } 2111 2111 tgtp->tport_unreg_cmp = &tport_unreg_cmp; 2112 2112 nvmet_fc_unregister_targetport(phba->targetport); 2113 - if (!wait_for_completion_timeout(tgtp->tport_unreg_cmp, 2113 + if (!wait_for_completion_timeout(&tport_unreg_cmp, 2114 2114 msecs_to_jiffies(LPFC_NVMET_WAIT_TMO))) 2115 2115 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 2116 2116 "6179 Unreg targetport x%px timeout "
+9 -2
drivers/scsi/lpfc/lpfc_sli.c
··· 13650 13650 fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) { 13651 13651 spin_unlock_irqrestore(&phba->hbalock, iflags); 13652 13652 /* Handle MDS Loopback frames */ 13653 - lpfc_sli4_handle_mds_loopback(phba->pport, dma_buf); 13653 + if (!(phba->pport->load_flag & FC_UNLOADING)) 13654 + lpfc_sli4_handle_mds_loopback(phba->pport, 13655 + dma_buf); 13656 + else 13657 + lpfc_in_buf_free(phba, &dma_buf->dbuf); 13654 13658 break; 13655 13659 } 13656 13660 ··· 18367 18363 fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) { 18368 18364 vport = phba->pport; 18369 18365 /* Handle MDS Loopback frames */ 18370 - lpfc_sli4_handle_mds_loopback(vport, dmabuf); 18366 + if (!(phba->pport->load_flag & FC_UNLOADING)) 18367 + lpfc_sli4_handle_mds_loopback(vport, dmabuf); 18368 + else 18369 + lpfc_in_buf_free(phba, &dmabuf->dbuf); 18371 18370 return; 18372 18371 } 18373 18372
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "12.8.0.2" 23 + #define LPFC_DRIVER_VERSION "12.8.0.3" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+1 -1
drivers/scsi/scsi_transport_sas.c
··· 1526 1526 list_add_tail(&rphy->list, &sas_host->rphy_list); 1527 1527 if (identify->device_type == SAS_END_DEVICE && 1528 1528 (identify->target_port_protocols & 1529 - (SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA))) 1529 + (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA))) 1530 1530 rphy->scsi_target_id = sas_host->next_target_id++; 1531 1531 else if (identify->device_type == SAS_END_DEVICE) 1532 1532 rphy->scsi_target_id = -1;
+8 -2
drivers/scsi/sd.c
··· 2578 2578 sd_printk(KERN_NOTICE, sdkp, 2579 2579 "%u-byte physical blocks\n", 2580 2580 sdkp->physical_block_size); 2581 - 2582 - sd_zbc_print_zones(sdkp); 2583 2581 } 2584 2582 2585 2583 /* called with buffer of length 512 */ ··· 3217 3219 logical_to_sectors(sdp, sdkp->capacity), false); 3218 3220 sd_config_write_same(sdkp); 3219 3221 kfree(buffer); 3222 + 3223 + /* 3224 + * For a zoned drive, revalidating the zones can be done only once 3225 + * the gendisk capacity is set. So if this fails, set back the gendisk 3226 + * capacity to 0. 3227 + */ 3228 + if (sd_zbc_revalidate_zones(sdkp)) 3229 + set_capacity_revalidate_and_notify(disk, 0, false); 3220 3230 3221 3231 out: 3222 3232 return 0;
+8 -3
drivers/scsi/sd.h
··· 75 75 struct opal_dev *opal_dev; 76 76 #ifdef CONFIG_BLK_DEV_ZONED 77 77 u32 nr_zones; 78 + u32 rev_nr_zones; 78 79 u32 zone_blocks; 80 + u32 rev_zone_blocks; 79 81 u32 zones_optimal_open; 80 82 u32 zones_optimal_nonseq; 81 83 u32 zones_max_open; ··· 217 215 218 216 int sd_zbc_init_disk(struct scsi_disk *sdkp); 219 217 void sd_zbc_release_disk(struct scsi_disk *sdkp); 220 - extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer); 221 - extern void sd_zbc_print_zones(struct scsi_disk *sdkp); 218 + int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer); 219 + int sd_zbc_revalidate_zones(struct scsi_disk *sdkp); 222 220 blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd, 223 221 unsigned char op, bool all); 224 222 unsigned int sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes, ··· 244 242 return 0; 245 243 } 246 244 247 - static inline void sd_zbc_print_zones(struct scsi_disk *sdkp) {} 245 + static inline int sd_zbc_revalidate_zones(struct scsi_disk *sdkp) 246 + { 247 + return 0; 248 + } 248 249 249 250 static inline blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd, 250 251 unsigned char op,
+44 -49
drivers/scsi/sd_zbc.c
··· 634 634 return 0; 635 635 } 636 636 637 + static void sd_zbc_print_zones(struct scsi_disk *sdkp) 638 + { 639 + if (!sd_is_zoned(sdkp) || !sdkp->capacity) 640 + return; 641 + 642 + if (sdkp->capacity & (sdkp->zone_blocks - 1)) 643 + sd_printk(KERN_NOTICE, sdkp, 644 + "%u zones of %u logical blocks + 1 runt zone\n", 645 + sdkp->nr_zones - 1, 646 + sdkp->zone_blocks); 647 + else 648 + sd_printk(KERN_NOTICE, sdkp, 649 + "%u zones of %u logical blocks\n", 650 + sdkp->nr_zones, 651 + sdkp->zone_blocks); 652 + } 653 + 637 654 static void sd_zbc_revalidate_zones_cb(struct gendisk *disk) 638 655 { 639 656 struct scsi_disk *sdkp = scsi_disk(disk); ··· 658 641 swap(sdkp->zones_wp_offset, sdkp->rev_wp_offset); 659 642 } 660 643 661 - static int sd_zbc_revalidate_zones(struct scsi_disk *sdkp, 662 - u32 zone_blocks, 663 - unsigned int nr_zones) 644 + int sd_zbc_revalidate_zones(struct scsi_disk *sdkp) 664 645 { 665 646 struct gendisk *disk = sdkp->disk; 647 + struct request_queue *q = disk->queue; 648 + u32 zone_blocks = sdkp->rev_zone_blocks; 649 + unsigned int nr_zones = sdkp->rev_nr_zones; 650 + u32 max_append; 666 651 int ret = 0; 652 + 653 + if (!sd_is_zoned(sdkp)) 654 + return 0; 667 655 668 656 /* 669 657 * Make sure revalidate zones are serialized to ensure exclusive ··· 676 654 */ 677 655 mutex_lock(&sdkp->rev_mutex); 678 656 679 - /* 680 - * Revalidate the disk zones to update the device request queue zone 681 - * bitmaps and the zone write pointer offset array. Do this only once 682 - * the device capacity is set on the second revalidate execution for 683 - * disk scan or if something changed when executing a normal revalidate. 684 - */ 685 - if (sdkp->first_scan) { 686 - sdkp->zone_blocks = zone_blocks; 687 - sdkp->nr_zones = nr_zones; 688 - goto unlock; 689 - } 690 - 691 657 if (sdkp->zone_blocks == zone_blocks && 692 658 sdkp->nr_zones == nr_zones && 693 659 disk->queue->nr_zones == nr_zones) 694 660 goto unlock; 695 661 662 + sdkp->zone_blocks = zone_blocks; 663 + sdkp->nr_zones = nr_zones; 696 664 sdkp->rev_wp_offset = kvcalloc(nr_zones, sizeof(u32), GFP_NOIO); 697 665 if (!sdkp->rev_wp_offset) { 698 666 ret = -ENOMEM; ··· 693 681 694 682 kvfree(sdkp->rev_wp_offset); 695 683 sdkp->rev_wp_offset = NULL; 684 + 685 + if (ret) { 686 + sdkp->zone_blocks = 0; 687 + sdkp->nr_zones = 0; 688 + sdkp->capacity = 0; 689 + goto unlock; 690 + } 691 + 692 + max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks), 693 + q->limits.max_segments << (PAGE_SHIFT - 9)); 694 + max_append = min_t(u32, max_append, queue_max_hw_sectors(q)); 695 + 696 + blk_queue_max_zone_append_sectors(q, max_append); 697 + 698 + sd_zbc_print_zones(sdkp); 696 699 697 700 unlock: 698 701 mutex_unlock(&sdkp->rev_mutex); ··· 721 694 struct request_queue *q = disk->queue; 722 695 unsigned int nr_zones; 723 696 u32 zone_blocks = 0; 724 - u32 max_append; 725 697 int ret; 726 698 727 699 if (!sd_is_zoned(sdkp)) ··· 754 728 sdkp->device->use_16_for_rw = 1; 755 729 sdkp->device->use_10_for_rw = 0; 756 730 757 - ret = sd_zbc_revalidate_zones(sdkp, zone_blocks, nr_zones); 758 - if (ret) 759 - goto err; 760 - 761 - /* 762 - * On the first scan 'chunk_sectors' isn't setup yet, so calling 763 - * blk_queue_max_zone_append_sectors() will result in a WARN(). Defer 764 - * this setting to the second scan. 765 - */ 766 - if (sdkp->first_scan) 767 - return 0; 768 - 769 - max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks), 770 - q->limits.max_segments << (PAGE_SHIFT - 9)); 771 - 772 - blk_queue_max_zone_append_sectors(q, max_append); 731 + sdkp->rev_nr_zones = nr_zones; 732 + sdkp->rev_zone_blocks = zone_blocks; 773 733 774 734 return 0; 775 735 ··· 763 751 sdkp->capacity = 0; 764 752 765 753 return ret; 766 - } 767 - 768 - void sd_zbc_print_zones(struct scsi_disk *sdkp) 769 - { 770 - if (!sd_is_zoned(sdkp) || !sdkp->capacity) 771 - return; 772 - 773 - if (sdkp->capacity & (sdkp->zone_blocks - 1)) 774 - sd_printk(KERN_NOTICE, sdkp, 775 - "%u zones of %u logical blocks + 1 runt zone\n", 776 - sdkp->nr_zones - 1, 777 - sdkp->zone_blocks); 778 - else 779 - sd_printk(KERN_NOTICE, sdkp, 780 - "%u zones of %u logical blocks\n", 781 - sdkp->nr_zones, 782 - sdkp->zone_blocks); 783 754 } 784 755 785 756 int sd_zbc_init_disk(struct scsi_disk *sdkp)
+1 -3
drivers/target/iscsi/iscsi_target_transport.c
··· 31 31 module_put(t->owner); 32 32 } 33 33 34 - int iscsit_register_transport(struct iscsit_transport *t) 34 + void iscsit_register_transport(struct iscsit_transport *t) 35 35 { 36 36 INIT_LIST_HEAD(&t->t_node); 37 37 ··· 40 40 mutex_unlock(&transport_mutex); 41 41 42 42 pr_debug("Registered iSCSI transport: %s\n", t->name); 43 - 44 - return 0; 45 43 } 46 44 EXPORT_SYMBOL(iscsit_register_transport); 47 45
+1 -1
include/target/iscsi/iscsi_transport.h
··· 43 43 * From iscsi_target_transport.c 44 44 */ 45 45 46 - extern int iscsit_register_transport(struct iscsit_transport *); 46 + extern void iscsit_register_transport(struct iscsit_transport *); 47 47 extern void iscsit_unregister_transport(struct iscsit_transport *); 48 48 extern struct iscsit_transport *iscsit_get_transport(int); 49 49 extern void iscsit_put_transport(struct iscsit_transport *);