]> Git Repo - linux.git/commitdiff
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
authorLinus Torvalds <[email protected]>
Fri, 14 Aug 2020 23:01:59 +0000 (16:01 -0700)
committerLinus Torvalds <[email protected]>
Fri, 14 Aug 2020 23:01:59 +0000 (16:01 -0700)
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

1  2 
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/sd_zbc.c

index c4a7e82d3ff2449a6f7decfa3e03e88fbc64732a,05ace6916b661451ba692ba5176fc676a45d2408..c697259993159d1c6895f2d1a7c8653e5ae48256
@@@ -4577,6 -4577,13 +4577,13 @@@ static void lpfc_host_supported_speeds_
        struct lpfc_hba   *phba = vport->phba;
  
        fc_host_supported_speeds(shost) = 0;
+       /*
+        * Avoid reporting supported link speed for FCoE as it can't be
+        * controlled via FCoE.
+        */
+       if (phba->hba_flag & HBA_FCOE_MODE)
+               return;
        if (phba->lmt & LMT_128Gb)
                fc_host_supported_speeds(shost) |= FC_PORTSPEED_128GBIT;
        if (phba->lmt & LMT_64Gb)
@@@ -4910,6 -4917,9 +4917,9 @@@ lpfc_sli4_port_speed_parse(struct lpfc_
                case LPFC_ASYNC_LINK_SPEED_40GBPS:
                        port_speed = 40000;
                        break;
+               case LPFC_ASYNC_LINK_SPEED_100GBPS:
+                       port_speed = 100000;
+                       break;
                default:
                        port_speed = 0;
                }
@@@ -8589,7 -8599,7 +8599,7 @@@ lpfc_sli4_read_config(struct lpfc_hba *
                                "VPI(B:%d M:%d) "
                                "VFI(B:%d M:%d) "
                                "RPI(B:%d M:%d) "
-                               "FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d\n",
+                               "FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d lmt:x%x\n",
                                phba->sli4_hba.extents_in_use,
                                phba->sli4_hba.max_cfg_param.xri_base,
                                phba->sli4_hba.max_cfg_param.max_xri,
                                phba->sli4_hba.max_cfg_param.max_eq,
                                phba->sli4_hba.max_cfg_param.max_cq,
                                phba->sli4_hba.max_cfg_param.max_wq,
-                               phba->sli4_hba.max_cfg_param.max_rq);
+                               phba->sli4_hba.max_cfg_param.max_rq,
+                               phba->lmt);
  
                /*
                 * Calculate queue resources based on how
                if ((phba->cfg_irq_chann > qmin) ||
                    (phba->cfg_hdw_queue > qmin)) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-                                       "2005 Reducing Queues: "
+                                       "2005 Reducing Queues - "
+                                       "FW resource limitation: "
                                        "WQ %d CQ %d EQ %d: min %d: "
                                        "IRQ %d HDWQ %d\n",
                                        phba->sli4_hba.max_cfg_param.max_wq,
@@@ -11996,8 -12008,7 +12008,8 @@@ lpfc_sli4_hba_unset(struct lpfc_hba *ph
        lpfc_sli4_xri_exchange_busy_wait(phba);
  
        /* per-phba callback de-registration for hotplug event */
 -      lpfc_cpuhp_remove(phba);
 +      if (phba->pport)
 +              lpfc_cpuhp_remove(phba);
  
        /* Disable PCI subsystem interrupt */
        lpfc_sli4_disable_intr(phba);
@@@ -14100,17 -14111,18 +14112,18 @@@ lpfc_init(void
                printk(KERN_ERR "Could not register lpfcmgmt device, "
                        "misc_register returned with status %d", error);
  
+       error = -ENOMEM;
        lpfc_transport_functions.vport_create = lpfc_vport_create;
        lpfc_transport_functions.vport_delete = lpfc_vport_delete;
        lpfc_transport_template =
                                fc_attach_transport(&lpfc_transport_functions);
        if (lpfc_transport_template == NULL)
-               return -ENOMEM;
+               goto unregister;
        lpfc_vport_transport_template =
                fc_attach_transport(&lpfc_vport_transport_functions);
        if (lpfc_vport_transport_template == NULL) {
                fc_release_transport(lpfc_transport_template);
-               return -ENOMEM;
+               goto unregister;
        }
        lpfc_nvme_cmd_template();
        lpfc_nvmet_cmd_template();
@@@ -14136,6 -14148,8 +14149,8 @@@ unwind
  cpuhp_failure:
        fc_release_transport(lpfc_transport_template);
        fc_release_transport(lpfc_vport_transport_template);
+ unregister:
+       misc_deregister(&lpfc_mgmt_dev);
  
        return error;
  }
diff --combined drivers/scsi/sd_zbc.c
index 4717e79bff5571f976532f21f6cd242fac6cc7cd,fee0815d7e654a97c55c518e0f4bddd60df7cfd3..0e94ff056bff4fe516d8027a33544010d6ed1ebf
@@@ -59,7 -59,6 +59,7 @@@ static int sd_zbc_parse_report(struct s
                zone.non_seq = 1;
  
        zone.len = logical_to_sectors(sdp, get_unaligned_be64(&buf[8]));
 +      zone.capacity = zone.len;
        zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
        zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
        if (zone.type != ZBC_ZONE_TYPE_CONV &&
@@@ -634,6 -633,23 +634,23 @@@ static int sd_zbc_check_capacity(struc
        return 0;
  }
  
+ static void sd_zbc_print_zones(struct scsi_disk *sdkp)
+ {
+       if (!sd_is_zoned(sdkp) || !sdkp->capacity)
+               return;
+       if (sdkp->capacity & (sdkp->zone_blocks - 1))
+               sd_printk(KERN_NOTICE, sdkp,
+                         "%u zones of %u logical blocks + 1 runt zone\n",
+                         sdkp->nr_zones - 1,
+                         sdkp->zone_blocks);
+       else
+               sd_printk(KERN_NOTICE, sdkp,
+                         "%u zones of %u logical blocks\n",
+                         sdkp->nr_zones,
+                         sdkp->zone_blocks);
+ }
  static void sd_zbc_revalidate_zones_cb(struct gendisk *disk)
  {
        struct scsi_disk *sdkp = scsi_disk(disk);
        swap(sdkp->zones_wp_offset, sdkp->rev_wp_offset);
  }
  
- static int sd_zbc_revalidate_zones(struct scsi_disk *sdkp,
-                                  u32 zone_blocks,
-                                  unsigned int nr_zones)
+ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
  {
        struct gendisk *disk = sdkp->disk;
+       struct request_queue *q = disk->queue;
+       u32 zone_blocks = sdkp->rev_zone_blocks;
+       unsigned int nr_zones = sdkp->rev_nr_zones;
+       u32 max_append;
        int ret = 0;
  
+       if (!sd_is_zoned(sdkp))
+               return 0;
        /*
         * Make sure revalidate zones are serialized to ensure exclusive
         * updates of the scsi disk data.
         */
        mutex_lock(&sdkp->rev_mutex);
  
-       /*
-        * Revalidate the disk zones to update the device request queue zone
-        * bitmaps and the zone write pointer offset array. Do this only once
-        * the device capacity is set on the second revalidate execution for
-        * disk scan or if something changed when executing a normal revalidate.
-        */
-       if (sdkp->first_scan) {
-               sdkp->zone_blocks = zone_blocks;
-               sdkp->nr_zones = nr_zones;
-               goto unlock;
-       }
        if (sdkp->zone_blocks == zone_blocks &&
            sdkp->nr_zones == nr_zones &&
            disk->queue->nr_zones == nr_zones)
                goto unlock;
  
+       sdkp->zone_blocks = zone_blocks;
+       sdkp->nr_zones = nr_zones;
        sdkp->rev_wp_offset = kvcalloc(nr_zones, sizeof(u32), GFP_NOIO);
        if (!sdkp->rev_wp_offset) {
                ret = -ENOMEM;
        kvfree(sdkp->rev_wp_offset);
        sdkp->rev_wp_offset = NULL;
  
+       if (ret) {
+               sdkp->zone_blocks = 0;
+               sdkp->nr_zones = 0;
+               sdkp->capacity = 0;
+               goto unlock;
+       }
+       max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks),
+                          q->limits.max_segments << (PAGE_SHIFT - 9));
+       max_append = min_t(u32, max_append, queue_max_hw_sectors(q));
+       blk_queue_max_zone_append_sectors(q, max_append);
+       sd_zbc_print_zones(sdkp);
  unlock:
        mutex_unlock(&sdkp->rev_mutex);
  
@@@ -694,7 -720,6 +721,6 @@@ int sd_zbc_read_zones(struct scsi_disk 
        struct request_queue *q = disk->queue;
        unsigned int nr_zones;
        u32 zone_blocks = 0;
-       u32 max_append;
        int ret;
  
        if (!sd_is_zoned(sdkp))
        /* The drive satisfies the kernel restrictions: set it up */
        blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
        blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
 +      if (sdkp->zones_max_open == U32_MAX)
 +              blk_queue_max_open_zones(q, 0);
 +      else
 +              blk_queue_max_open_zones(q, sdkp->zones_max_open);
 +      blk_queue_max_active_zones(q, 0);
        nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks);
  
        /* READ16/WRITE16 is mandatory for ZBC disks */
        sdkp->device->use_16_for_rw = 1;
        sdkp->device->use_10_for_rw = 0;
  
-       ret = sd_zbc_revalidate_zones(sdkp, zone_blocks, nr_zones);
-       if (ret)
-               goto err;
-       /*
-        * On the first scan 'chunk_sectors' isn't setup yet, so calling
-        * blk_queue_max_zone_append_sectors() will result in a WARN(). Defer
-        * this setting to the second scan.
-        */
-       if (sdkp->first_scan)
-               return 0;
-       max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks),
-                          q->limits.max_segments << (PAGE_SHIFT - 9));
-       blk_queue_max_zone_append_sectors(q, max_append);
+       sdkp->rev_nr_zones = nr_zones;
+       sdkp->rev_zone_blocks = zone_blocks;
  
        return 0;
  
@@@ -753,23 -759,6 +765,6 @@@ err
        return ret;
  }
  
- void sd_zbc_print_zones(struct scsi_disk *sdkp)
- {
-       if (!sd_is_zoned(sdkp) || !sdkp->capacity)
-               return;
-       if (sdkp->capacity & (sdkp->zone_blocks - 1))
-               sd_printk(KERN_NOTICE, sdkp,
-                         "%u zones of %u logical blocks + 1 runt zone\n",
-                         sdkp->nr_zones - 1,
-                         sdkp->zone_blocks);
-       else
-               sd_printk(KERN_NOTICE, sdkp,
-                         "%u zones of %u logical blocks\n",
-                         sdkp->nr_zones,
-                         sdkp->zone_blocks);
- }
  int sd_zbc_init_disk(struct scsi_disk *sdkp)
  {
        if (!sd_is_zoned(sdkp))
This page took 0.145026 seconds and 4 git commands to generate.