1. Mar 18, 2020
    • Steffen Maier's avatar
      scsi: zfcp: wire previously driver-specific sysfs attributes also to fc_host · 538c6e91
      Steffen Maier authored
      Manufacturer, HBA model, firmware version, and hardware version.  Use the
      same value format as for the driver-specific attributes.  Keep the
      driver-specific attributes for stable user space sysfs API.
      
      Link: https://lore.kernel.org/r/20200312174505.51294-4-maier@linux.ibm.com
      
      
      Reviewed-by: default avatarJens Remus <jremus@linux.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      538c6e91
    • Steffen Maier's avatar
      scsi: zfcp: expose fabric name as common fc_host sysfs attribute · e05a10a0
      Steffen Maier authored
      FICON Express8S or older, as well as card features newer than FICON
      Express16S+ have no certain firmware level requirement.
      
      FICON Express16S or FICON Express16S+ have the following
      minimum firmware level requirements to show a proper fabric name value:
      
       z13 machine
        FICON Express16S  , MCL P08424.005 , LIC version 0x00000721
       z14 machine
        FICON Express16S  , MCL P42611.008 , LIC version 0x10200069
        FICON Express16S+ , MCL P42625.010 , LIC version 0x10300147
      
      Otherwise, the read value is not the fabric name.
      
      Each FCP channel of these card features might need one SAN fabric re-login
      after concurrent microcode update in order to show the proper fabric name.
      Possible ways to trigger a SAN fabric re-login are one of: Pull fibres
      between FCP channel port and SAN switch port on either side and re-plug,
      disable SAN switch port adjacent to FCP channel port and re-enable switch
      port, or at Service Element toggle off all CHPIDs of FCP channel over all
      LPARs and toggle CHPIDs on again.  Zfcp operating subchannels (FCP devices)
      on such FCP channel recovers a fabric re-login.
      
      Initialize fabric name for any topology and have it an invalid WWPN 0x0 for
      anything but fabric topology.  Otherwise for e.g. point-to-point topology
      one could see the initial -1 from fc_host_setup() and after a link unplug
      our fabric name would turn to 0x0 (with subsequent commit ("zfcp: fix
      fc_host attributes that should be unknown on local link down") and stay 0x0
      on link replug.  I did not initialize to 0x0 somewhere even earlier in the
      code path such that it would not flap from real to 0x0 to real on e.g. an
      exchange config data with fabric topology.
      
      Link: https://lore.kernel.org/r/20200312174505.51294-3-maier@linux.ibm.com
      
      
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Reviewed-by: default avatarJens Remus <jremus@linux.ibm.com>
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      e05a10a0
    • Steffen Maier's avatar
      scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point · 819732be
      Steffen Maier authored
      v2.6.27 commit cc8c2829 ("[SCSI] zfcp: Automatically attach remote
      ports") introduced zfcp automatic port scan.
      
      Before that, the user had to use the sysfs attribute "port_add" of an FCP
      device (adapter) to add and open remote (target) ports, even for the remote
      peer port in point-to-point topology. That code path did a proper port open
      recovery trigger taking the erp_lock.
      
      Since above commit, a new helper function zfcp_erp_open_ptp_port()
      performed an UNlocked port open recovery trigger. This can race with other
      parallel recovery triggers. In zfcp_erp_action_enqueue() this could corrupt
      e.g. adapter->erp_total_count or adapter->erp_ready_head.
      
      As already found for fabric topology in v4.17 commit fa89adba ("scsi:
      zfcp: fix infinite iteration on ERP ready list"), there was an endless loop
      during tracing of rport (un)block.  A subsequent v4.18 commit 9e156c54
      ("scsi: zfcp: assert that the ERP lock is held when tracing a recovery
      trigger") introduced a lockdep assertion for that case.
      
      As a side effect, that lockdep assertion now uncovered the unlocked code
      path for PtP. It is from within an adapter ERP action:
      
      zfcp_erp_strategy[1479]  intentionally DROPs erp lock around
                               zfcp_erp_strategy_do_action()
      zfcp_erp_strategy_do_action[1441]      NO erp lock
      zfcp_erp_adapter_strategy[876]         NO erp lock
      zfcp_erp_adapter_strategy_open[855]    NO erp lock
      zfcp_erp_adapter_strategy_open_fsf[806]NO erp lock
      zfcp_erp_adapter_strat_fsf_xconf[772]  erp lock only around
                                             zfcp_erp_action_to_running(),
                                             BUT *_not_* around
                                             zfcp_erp_enqueue_ptp_port()
      zfcp_erp_enqueue_ptp_port[728]         BUG: *_not_* taking erp lock
      _zfcp_erp_port_reopen[432]             assumes to be called with erp lock
      zfcp_erp_action_enqueue[314]           assumes to be called with erp lock
      zfcp_dbf_rec_trig[288]                 _checks_ to be called with erp lock:
      	lockdep_assert_held(&adapter->erp_lock);
      
      It causes the following lockdep warning:
      
      WARNING: CPU: 2 PID: 775 at drivers/s390/scsi/zfcp_dbf.c:288
                                  zfcp_dbf_rec_trig+0x16a/0x188
      no locks held by zfcperp0.0.17c0/775.
      
      Fix this by using the proper locked recovery trigger helper function.
      
      Link: https://lore.kernel.org/r/20200312174505.51294-2-maier@linux.ibm.com
      Fixes: cc8c2829
      
       ("[SCSI] zfcp: Automatically attach remote ports")
      Cc: <stable@vger.kernel.org> #v2.6.27+
      Reviewed-by: default avatarJens Remus <jremus@linux.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      819732be
  2. Mar 17, 2020
  3. Mar 12, 2020