1. 29 5月, 2018 13 次提交
  2. 19 5月, 2018 10 次提交
  3. 18 5月, 2018 17 次提交
    • B
      scsi: ufs: Use freq table with devfreq · 092b4558
      Bjorn Andersson 提交于
      devfreq requires that the client operates on actual frequencies, not only 0
      and UMAX_INT and as such UFS brok with the introduction of f1d981ea ("PM
      / devfreq: Use the available min/max frequency").
      
      This patch registers the frequencies of the first clock with devfreq and use
      these to determine if we're trying to step up or down.
      
      Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> [for devfreq & OPP part]
      Reviewed-by: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      092b4558
    • B
      scsi: ufs: Extract devfreq registration · deac444f
      Bjorn Andersson 提交于
      Failing to register with devfreq leaves hba->devfreq assigned, which causes
      the error path to dereference the ERR_PTR(). Rather than bolting on more
      conditionals, move the call of devm_devfreq_add_device() into it's own
      function and only update hba->devfreq once it's successfully registered.
      
      The subsequent patch builds upon this to make UFS actually work again, as
      it's been broken since f1d981ea ("PM / devfreq: Use the available
      min/max frequency")
      
      Also switch to use DEVFREQ_GOV_SIMPLE_ONDEMAND constant.
      Reviewed-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      deac444f
    • M
      scsi: storvsc: Avoid allocating memory for temp cpumasks · 1b25a8c4
      Michael Kelley 提交于
      Current code allocates 240 Kbytes (in typical configs) for each synthetic
      SCSI controller to use as temp cpumask variables.  Recode to avoid needing
      the temp cpumask variables and remove the memory allocation.
      Signed-off-by: NMichael Kelley <mikelley@microsoft.com>
      Acked-by: NStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      1b25a8c4
    • J
      scsi: zfcp: enhance comments on fc_link_speed and supported_speed · 16dad279
      Jens Remus 提交于
      The comment on fsf_qtcb_bottom_port.supported_speed did read as if the field
      can only assume one of two possible values (i.e. 0x1 for 1 GBit/s or 0x2 for
      2 GBit/s). This is not true for two reasons: first it is a flag field and
      can thus assume any combination and second there are meanwhile more speeds.
      
      Clarify comment on fsf_qtcb_bottom_port.supported_speed and add a comment to
      fsf_qtcb_bottom_config.fc_link_speed.
      Signed-off-by: NJens Remus <jremus@linux.ibm.com>
      Reviewed-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NFedor Loshakov <loshakov@linux.ibm.com>
      Acked-by: NBenjamin Block <bblock@linux.ibm.com>
      Acked-by: NHendrik Brueckner <brueckner@linux.ibm.com>
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      16dad279
    • J
      scsi: zfcp: add port speed capabilities · 6e2e4900
      Jens Remus 提交于
      Add port speed capabilities as defined in FC-LS RPSC ELS that have a
      counterpart FC_PORTSPEED_* defined in scsi/scsi_transport_fc.h.
      Suggested-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NJens Remus <jremus@linux.ibm.com>
      Reviewed-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NFedor Loshakov <loshakov@linux.ibm.com>
      Acked-by: NHendrik Brueckner <brueckner@linux.ibm.com>
      Acked-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      6e2e4900
    • J
      scsi: zfcp: assert that the ERP lock is held when tracing a recovery trigger · 9e156c54
      Jens Remus 提交于
      Otherwise iterating with list_for_each() over the adapter->erp_ready_head
      and adapter->erp_running_head lists can lead to an infinite loop. See commit
      "zfcp: fix infinite iteration on erp_ready_head list".
      
      The run-time check is only performed for debug kernels which have the kernel
      lock validator enabled. Following is an example of the warning that is
      reported, if the ERP lock is not held when calling zfcp_dbf_rec_trig():
      
      WARNING: CPU: 0 PID: 604 at drivers/s390/scsi/zfcp_dbf.c:288 zfcp_dbf_rec_trig+0x172/0x188
      Modules linked in: ...
      CPU: 0 PID: 604 Comm: kworker/u128:3 Not tainted 4.16.0-... #1
      Hardware name: IBM 2964 N96 702 (z/VM 6.4.0)
      Workqueue: zfcp_q_0.0.1906 zfcp_scsi_rport_work
      Krnl PSW : 00000000330fdbf9 00000000367e9728 (zfcp_dbf_rec_trig+0x172/0x188)
                 R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:3 PM:0 RI:0 EA:3
      Krnl GPRS: 00000000c57a5d99 3288200000000000 0000000000000000 000000006cc82740
                 00000000009d09d6 0000000000000000 00000000000000ff 0000000000000000
                 0000000000000000 0000000000e1b5fe 000000006de01d38 0000000076130958
                 000000006cc82548 000000006de01a98 00000000009d09d6 000000006a6d3c80
      Krnl Code: 00000000009d0ad2: eb7ff0b80004        lmg        %r7,%r15,184(%r15)
                 00000000009d0ad8: c0f4000d7dd0        brcl       15,b80678
                #00000000009d0ade: a7f40001            brc        15,9d0ae0
                >00000000009d0ae2: a7f4ff7d            brc        15,9d09dc
                 00000000009d0ae6: e340f0f00004        lg         %r4,240(%r15)
                 00000000009d0aec: eb7ff0b80004        lmg        %r7,%r15,184(%r15)
                 00000000009d0af2: 07f4                bcr        15,%r4
                 00000000009d0af4: 0707                bcr        0,%r7
      Call Trace:
      ([<00000000009d09d6>] zfcp_dbf_rec_trig+0x66/0x188)
       [<00000000009dd740>] zfcp_scsi_rport_work+0x98/0x190
       [<0000000000169b34>] process_one_work+0x3d4/0x6f8
       [<000000000016a08a>] worker_thread+0x232/0x418
       [<000000000017219e>] kthread+0x166/0x178
       [<0000000000b815ea>] kernel_thread_starter+0x6/0xc
       [<0000000000b815e4>] kernel_thread_starter+0x0/0xc
      2 locks held by kworker/u128:3/604:
       #0:  ((wq_completion)name){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8
       #1:  ((work_completion)(&port->rport_work)){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8
      Last Breaking-Event-Address:
       [<00000000009d0ade>] zfcp_dbf_rec_trig+0x16e/0x188
      ---[ end trace b2f4020572e2c124 ]---
      Suggested-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NJens Remus <jremus@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Reviewed-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      9e156c54
    • S
      scsi: zfcp: cleanup indentation for posting FC events · 6919298c
      Steffen Maier 提交于
      I just happened to see the function header indentation of
      zfcp_fc_enqueue_event() and I picked some more from checkpatch:
      
      $ checkpatch.pl --strict -f drivers/s390/scsi/zfcp_fc.c
      ...
      CHECK: Alignment should match open parenthesis
       #113: FILE: drivers/s390/scsi/zfcp_fc.c:113:
      +		fc_host_post_event(adapter->scsi_host, fc_get_event_number(),
      +				event->code, event->data);
      
      CHECK: Blank lines aren't necessary before a close brace '}'
       #118: FILE: drivers/s390/scsi/zfcp_fc.c:118:
      +
      +}
      ...
      
      The change complements v2.6.36 commit 2d1e547f ("[SCSI] zfcp: Post
      events through FC transport class").
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      6919298c
    • S
      scsi: zfcp: support SCSI_ADAPTER_RESET via scsi_host sysfs attribute host_reset · 35e9111a
      Steffen Maier 提交于
      Make use of feature introduced with v3.2 commit 29443691 ("[SCSI] scsi:
      Added support for adapter and firmware reset").  The common code interface
      was introduced for commit 95d31262 ("[SCSI] qla4xxx: Added support for
      adapter and firmware reset").
      
      $ echo adapter > /sys/class/scsi_host/host<N>/host_reset
      
      Example trace record formatted with zfcpdbf from s390-tools:
      
      Timestamp      : ...
      Area           : REC
      Subarea        : 00
      Level          : 1
      Exception      : -
      CPU ID         : ..
      Caller         : 0x...
      Record ID      : 1                      ZFCP_DBF_REC_TRIG
      Tag            : scshr_y                SCSI sysfs host_reset yes
      LUN            : 0xffffffffffffffff                     none (invalid)
      WWPN           : 0x0000000000000000                     none (invalid)
      D_ID           : 0x00000000                             none (invalid)
      Adapter status : 0x4500050b
      Port status    : 0x00000000                             none (invalid)
      LUN status     : 0x00000000                             none (invalid)
      Ready count    : 0x00000001
      Running count  : 0x00000000
      ERP want       : 0x04                   ZFCP_ERP_ACTION_REOPEN_ADAPTER
      ERP need       : 0x04                   ZFCP_ERP_ACTION_REOPEN_ADAPTER
      
      This is the common code equivalent to the zfcp-specific
      &dev_attr_adapter_failed.attr in zfcp_sysfs_adapter_attrs.attrs[]:
      
      $ echo 0 > /sys/bus/ccw/drivers/zfcp/<devbusid>/failed
      
      The unsupported case returns EOPNOTSUPP:
      
      $ echo firmware > /sys/class/scsi_host/host<N>/host_reset
      -bash: echo: write error: Operation not supported
      
      Example trace record formatted with zfcpdbf from s390-tools:
      
      Timestamp      : ...
      Area           : SCSI
      Subarea        : 00
      Level          : 1
      Exception      : -
      CPU ID         : ..
      Caller         : 0x...
      Record ID      : 1
      Tag            : scshr_n                        SCSI sysfs host_reset no
      Request ID     : 0x0000000000000000                     none (invalid)
      SCSI ID        : 0xffffffff                             none (invalid)
      SCSI LUN       : 0xffffffff                             none (invalid)
      SCSI LUN high  : 0xffffffff                             none (invalid)
      SCSI result    : 0xffffffa1                     -EOPNOTSUPP==-95
      SCSI retries   : 0xff                                   none (invalid)
      SCSI allowed   : 0xff                                   none (invalid)
      SCSI scribble  : 0xffffffffffffffff                     none (invalid)
      SCSI opcode    : ffffffff ffffffff ffffffff ffffffff    none (invalid)
      FCP rsp inf cod: 0xff                                   none (invalid)
      FCP rsp IU     : 00000000 00000000 00000000 00000000    none (invalid)
                       00000000 00000000
      
      For any other invalid value, common code returns EINVAL without invoking
      our callback:
      
      $ echo foo > /sys/class/scsi_host/host<N>/host_reset
      -bash: echo: write error: Invalid argument
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      35e9111a
    • S
      scsi: zfcp: explicitly support initiator in scsi_host_template · b24bf22d
      Steffen Maier 提交于
      While the default did already correctly print "Initiator" let's make it
      explicit and convert zfcp to the feature.
      
      $ cat /sys/class/scsi_host/host0/supported_mode
      Initiator
      
      $ cat /sys/class/scsi_host/host0/active_mode
      Initiator
      
      The default worked, because not setting the field has it initialized to zero
      == MODE_UNKNOWN. scsi_host_alloc() sets shost->active_mode = MODE_INITIATOR
      in this case. The sysfs accessor function show_shost_supported_mode()
      assumes MODE_INITIATOR in this case.  This default behavior was introduced
      with v2.6.24 commit 7a39ac3f ("[SCSI] make supported_mode default to
      initiator.").  The feature flag was introduced with v2.6.24 commit
      5dc2b89e ("[SCSI] add supported_mode and active_mode attributes to the
      host").  So there was no release where zfcp would have shown "unknown".
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b24bf22d
    • S
      scsi: zfcp: remove unused return values of ERP trigger functions · 2fdd45fd
      Steffen Maier 提交于
      Since v2.6.27 commit 553448f6 ("[SCSI] zfcp: Message cleanup"), none of
      the callers has been interested any more.  Values were not returned
      consistently in all ERP trigger functions.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      2fdd45fd
    • S
      scsi: zfcp: zfcp_erp_action_exists() does only check for running · 013af857
      Steffen Maier 提交于
      Simplify its signature to return boolean and rename it to
      zfcp_erp_action_is_running() to indicate its actual unmodified semantics.
      It has always been used like this since v2.6.0 history commit ea127f975424
      ("[PATCH] s390 (7/7): zfcp host adapter.").
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      013af857
    • S
      scsi: zfcp: remove unused ERP enum values · cd4a186a
      Steffen Maier 提交于
      All constant defines were introduced with v2.6.0 history commit ea127f975424
      ("[PATCH] s390 (7/7): zfcp host adapter.") and refactored into enums with
      commit 287ac01a ("[SCSI] zfcp: Cleanup code in zfcp_erp.c").
      
      ZFCP_STATUS_ERP_DISMISSING and ZFCP_ERP_STEP_FSF_XCONFIG were never used.
      
      v2.6.27 commit 287ac01a ("[SCSI] zfcp: Cleanup code in zfcp_erp.c")
      removed the use of ZFCP_ERP_ACTION_READY on refactoring
      zfcp_erp_action_exists() to now only check adapter->erp_running_head but no
      longer adapter->erp_ready_head. The same commit could have changed the
      function return type from int to "enum zfcp_erp_act_state".
      ZFCP_ERP_ACTION_READY was never used outside of zfcp_erp_action_exists().
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      cd4a186a
    • S
      scsi: zfcp: consistently use function name space prefix · d39eda54
      Steffen Maier 提交于
      I've been mixing up
      zfcp_task_mgmt_function() [SCSI] and
      zfcp_fsf_fcp_task_mgmt()  [FSF]
      so often lately that I wanted to fix this.
      
      SCSI changes complement v2.6.27 commit f76af7d7 ("[SCSI] zfcp: Cleanup
      of code in zfcp_scsi.c").
      
      While at it, also fixup the other inconsistencies elsewhere.
      
      ERP changes complement v2.6.27 commit 287ac01a ("[SCSI] zfcp: Cleanup
      code in zfcp_erp.c") which introduced status_change_set().
      
      FC changes complement v2.6.32 commit 6f53a2d2 ("[SCSI] zfcp: Apply
      common naming conventions to zfcp_fc").  by renaming a leftover introduced
      with v2.6.27 commit cc8c2829 ("[SCSI] zfcp: Automatically attach remote
      ports").
      
      FSF changes fixup v2.6.32 commit a4623c46 ("[SCSI] zfcp: Improve request
      allocation through mempools").  which replaced zfcp_fsf_alloc_qtcb()
      introduced with v2.6.27 commit c41f8cbd ("[SCSI] zfcp: zfcp_fsf
      cleanup.").
      
      SCSI fc_host statistics were introduced with v2.6.16 commit f6cd94b1
      ("[SCSI] zfcp: transport class adaptations").
      
      SCSI fc_host port_state was introduced with v2.6.27 commit 85a82392
      ("[SCSI] zfcp: Add port_state attribute to sysfs").
      
      SCSI rport setter for dev_loss_tmo was introduced with v2.6.18 commit
      338151e0 ("[SCSI] zfcp: make use of fc_remote_port_delete when target
      port is unavailable").
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      d39eda54
    • S
      scsi: zfcp: workqueue: set description for port work items with their WWPN as context · 5c750d58
      Steffen Maier 提交于
      As a prerequisite, complement commit 3d1cb205 ("workqueue: include
      workqueue info when printing debug dump of a worker task") to be usable with
      kernel modules by exporting the symbol set_worker_desc().  Current built-in
      user was introduced with commit ef3b1019 ("writeback: set worker desc to
      identify writeback workers in task dumps").
      
      Can help distinguishing work items which do not have adapter scope.
      Description is printed out with task dump for debugging on WARN, BUG, panic,
      or magic-sysrq [show-task-states(t)].
      
      Example:
      $ echo 0 >| /sys/bus/ccw/drivers/zfcp/0.0.1880/0x50050763031bd327/failed &
      $ echo 't' >| /proc/sysrq-trigger
      $ dmesg
      sysrq: SysRq : Show State
        task                        PC stack   pid father
      ...
      zfcp_q_0.0.1880 S14640  2165      2 0x02000000
      Call Trace:
      ([<00000000009df464>] __schedule+0xbf4/0xc78)
       [<00000000009df57c>] schedule+0x94/0xc0
       [<0000000000168654>] rescuer_thread+0x33c/0x3a0
       [<000000000016f8be>] kthread+0x166/0x178
       [<00000000009e71f2>] kernel_thread_starter+0x6/0xc
       [<00000000009e71ec>] kernel_thread_starter+0x0/0xc
      no locks held by zfcp_q_0.0.1880/2165.
      ...
      kworker/u512:2  D11280  2193      2 0x02000000
      Workqueue: zfcp_q_0.0.1880 zfcp_scsi_rport_work [zfcp] (zrpd-50050763031bd327)
                                                              ^^^^^^^^^^^^^^^^^^^^^
      Call Trace:
      ([<00000000009df464>] __schedule+0xbf4/0xc78)
       [<00000000009df57c>] schedule+0x94/0xc0
       [<00000000009e50c0>] schedule_timeout+0x488/0x4d0
       [<00000000001e425c>] msleep+0x5c/0x78                  >>test code only<<
       [<000003ff8008a21e>] zfcp_scsi_rport_work+0xbe/0x100 [zfcp]
       [<0000000000167154>] process_one_work+0x3b4/0x718
       [<000000000016771c>] worker_thread+0x264/0x408
       [<000000000016f8be>] kthread+0x166/0x178
       [<00000000009e71f2>] kernel_thread_starter+0x6/0xc
       [<00000000009e71ec>] kernel_thread_starter+0x0/0xc
      2 locks held by kworker/u512:2/2193:
       #0:  (name){++++.+}, at: [<0000000000166f4e>] process_one_work+0x1ae/0x718
       #1:  ((&(&port->rport_work)->work)){+.+.+.}, at: [<0000000000166f4e>] process_one_work+0x1ae/0x718
      ...
      
      =============================================
      Showing busy workqueues and worker pools:
      workqueue zfcp_q_0.0.1880: flags=0x2000a
        pwq 512: cpus=0-255 flags=0x4 nice=0 active=1/1
          in-flight: 2193:zfcp_scsi_rport_work [zfcp]
      pool 512: cpus=0-255 flags=0x4 nice=0 hung=0s workers=4 idle: 5 2354 2311
      
      Work items with adapter scope are already identified by the workqueue name
      "zfcp_q_<devbusid>" and the work item function name.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      5c750d58
    • S
      scsi: zfcp: decouple our scsi_eh callbacks from scsi_cmnd · 674595d8
      Steffen Maier 提交于
      Note: zfcp_scsi_eh_host_reset_handler() will be converted in a later patch.
      
      zfcp_scsi_eh_device_reset_handler() now only depends on scsi_device.
      zfcp_scsi_eh_target_reset_handler() now only depends on scsi_target.
      All derive other objects from these intended callback arguments.
      
      zfcp_scsi_eh_target_reset_handler() is special: The FCP channel requires a
      valid LUN handle so we try to find ourselves a stand-in scsi_device as
      suggested by Hannes Reinecke. If it cannot find a stand-in scsi device,
      trace a record like the following (formatted with zfcpdbf from s390-tools):
      
      Timestamp      : ...
      Area           : SCSI
      Subarea        : 00
      Level          : 1
      Exception      : -
      CPU ID         : ..
      Caller         : 0x...
      Record ID      : 1
      Tag            : tr_nosd        target reset, no SCSI device
      Request ID     : 0x0000000000000000                     none (invalid)
      SCSI ID        : 0x00000000     SCSI ID/target denoting scope
      SCSI LUN       : 0xffffffff                             none (invalid)
      SCSI LUN high  : 0xffffffff                             none (invalid)
      SCSI result    : 0x00002003     field re-used for midlayer value: FAILED
      SCSI retries   : 0xff                                   none (invalid)
      SCSI allowed   : 0xff                                   none (invalid)
      SCSI scribble  : 0xffffffffffffffff                     none (invalid)
      SCSI opcode    : ffffffff ffffffff ffffffff ffffffff    none (invalid)
      FCP rsp inf cod: 0xff                                   none (invalid)
      FCP rsp IU     : 00000000 00000000 00000000 00000000    none (invalid)
                       00000000 00000000
      
      Actually change the signature of zfcp_task_mgmt_function() used by
      zfcp_scsi_eh_device_reset_handler() & zfcp_scsi_eh_target_reset_handler().
      Since it was prepared in a previous patch, we only need to delete a local
      auto variable which is now the intended argument.
      Suggested-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      674595d8
    • S
      scsi: zfcp: decouple TMFs from scsi_cmnd by using fc_block_rport · 42afc652
      Steffen Maier 提交于
      Intentionally retrieve the rport by walking SCSI common code objects
      rather than zfcp_sdev->port->rport.
      
      The latter is used for pairing the calls to fc_remote_port_add() and
      fc_remote_port_delete(). [see v2.6.31 commit 379d6bf6 ("[SCSI] zfcp:
      Add port only once to FC transport class")]
      
      zfcp_scsi_rport_register() sets zfcp_port.rport to what
      fc_remote_port_add() returned.
      zfcp_scsi_rport_block() sets zfcp_port.rport = NULL after having called
      fc_remote_port_delete().
      
      Hence, while an rport is blocked (or in any subsequent state due to
      scsi_transport_fc timeouts such as fast_io_fail_tmo or dev_loss_tmo),
      zfcp_port.rport is NULL and cannot serve as argument to fc_block_rport().
      
      During zfcp recovery, a just recovered zfcp_port can have the UNBLOCKED
      status flag, but an async rport unblocking has only started via
      zfcp_scsi_schedule_rport_register() in zfcp_erp_try_rport_unblock()
      [see v4.10 commit 6f2ce1c6 ("scsi: zfcp: fix rport unblock race with
      LUN recovery")] in zfcp_erp_action_cleanup(). Now zfcp_erp_wait() can
      return. This would be sufficient to successfully send a TMF.
      But the rport can still be blocked and zfcp_port.rport can still be NULL
      until zfcp_port.rport_work was scheduled and has actually called
      fc_remote_port_add() and assigned its return value to zfcp_port.rport.
      We need an unblocked rport for a successful scsi_eh TUR.
      
      Similarly, for a zfcp_port which has just lost its UNBLOCKED status flag,
      the return of zfcp_erp_wait() can race with zfcp_port.rport_work queued
      by zfcp_scsi_schedule_rport_block(). Therefore we cannot reliably access
      zfcp_port.rport. However, we'd like to get fc_rport_block()'s opinion on
      when fast_io_fail_tmo triggered. While we might use
      flush_work(&port->rport_work) to sync with the work item, we can simply use
      the other way to get an rport pointer.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      42afc652
    • S
      scsi: zfcp: decouple SCSI setup of TMF from scsi_cmnd · 26f5fa9d
      Steffen Maier 提交于
      Actually change the signature of zfcp_fsf_fcp_task_mgmt().
      Since it was prepared in the previous patch, we only need to delete
      a local auto variable which is now the intended argument.
      
      Prepare zfcp_fsf_fcp_task_mgmt's caller zfcp_task_mgmt_function()
      to have its function body only depend on a scsi_device and derived objects.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      26f5fa9d