17 Aug, 2022

2 commits

  • [ Upstream commit 31500e902759322ba3c64b60dabae2704e738df8 ]

    When the system is shutting down, iscsid is not running so we will not get
    a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown
    will then hang waiting on userspace to remove the session.

    This has libiscsi force the destruction of the session from the kernel when
    iscsi_host_remove() is called from a driver's shutdown callout.

    This fixes a regression added in qedi boot with commit d1f2ce77638d ("scsi:
    qedi: Fix host removal with running sessions") which made qedi use the
    common session removal function that waits on userspace instead of rolling
    its own kernel based removal.

    Link: https://lore.kernel.org/r/20220616222738.5722-7-michael.christie@oracle.com
    Fixes: d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions")
    Tested-by: Nilesh Javali
    Reviewed-by: Lee Duncan
    Reviewed-by: Nilesh Javali
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     
  • [ Upstream commit bb42856bfd54fda1cbc7c470fcf5db1596938f4f ]

    During qedi shutdown we need to stop the iSCSI layer from sending new nops
    as pings and from responding to target ones and make sure there is no
    running connection cleanups. Commit d1f2ce77638d ("scsi: qedi: Fix host
    removal with running sessions") converted the driver to use the libicsi
    helper to drive session removal, so the above issues could be handled. The
    problem is that during system shutdown iscsid will not be running so when
    we try to remove the root session we will hang waiting for userspace to
    reply.

    Add a helper that will drive the destruction of sessions like these during
    system shutdown.

    Link: https://lore.kernel.org/r/20220616222738.5722-5-michael.christie@oracle.com
    Tested-by: Nilesh Javali
    Reviewed-by: Nilesh Javali
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     

09 Jun, 2022

2 commits

  • [ Upstream commit 54db804d5d7d36709d1ce70bde3b9a6c61b290b6 ]

    Fix the following Wstringop-overflow warnings when building with GCC-11:

    drivers/scsi/fcoe/fcoe.c: In function ‘fcoe_netdev_config’:
    drivers/scsi/fcoe/fcoe.c:744:32: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    744 | wwnn = fcoe_wwn_from_mac(ctlr->ctl_src_addr, 1, 0);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/fcoe/fcoe.c:744:32: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/fcoe/fcoe.c:36:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~
    drivers/scsi/fcoe/fcoe.c:747:32: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    747 | wwpn = fcoe_wwn_from_mac(ctlr->ctl_src_addr,
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    748 | 2, 0);
    | ~~~~~
    drivers/scsi/fcoe/fcoe.c:747:32: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/fcoe/fcoe.c:36:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~
    CC drivers/scsi/bnx2fc/bnx2fc_io.o
    In function ‘bnx2fc_net_config’,
    inlined from ‘bnx2fc_if_create’ at drivers/scsi/bnx2fc/bnx2fc_fcoe.c:1543:7:
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c:833:32: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    833 | wwnn = fcoe_wwn_from_mac(ctlr->ctl_src_addr,
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    834 | 1, 0);
    | ~~~~~
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c: In function ‘bnx2fc_if_create’:
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c:833:32: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/bnx2fc/bnx2fc.h:53,
    from drivers/scsi/bnx2fc/bnx2fc_fcoe.c:17:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~
    In function ‘bnx2fc_net_config’,
    inlined from ‘bnx2fc_if_create’ at drivers/scsi/bnx2fc/bnx2fc_fcoe.c:1543:7:
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c:839:32: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    839 | wwpn = fcoe_wwn_from_mac(ctlr->ctl_src_addr,
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    840 | 2, 0);
    | ~~~~~
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c: In function ‘bnx2fc_if_create’:
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c:839:32: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/bnx2fc/bnx2fc.h:53,
    from drivers/scsi/bnx2fc/bnx2fc_fcoe.c:17:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~
    drivers/scsi/qedf/qedf_main.c: In function ‘__qedf_probe’:
    drivers/scsi/qedf/qedf_main.c:3520:30: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    3520 | qedf->wwnn = fcoe_wwn_from_mac(qedf->mac, 1, 0);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/qedf/qedf_main.c:3520:30: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/qedf/qedf.h:9,
    from drivers/scsi/qedf/qedf_main.c:23:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~
    drivers/scsi/qedf/qedf_main.c:3521:30: warning: ‘fcoe_wwn_from_mac’ accessing 32 bytes in a region of size 6 [-Wstringop-overflow=]
    3521 | qedf->wwpn = fcoe_wwn_from_mac(qedf->mac, 2, 0);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/qedf/qedf_main.c:3521:30: note: referencing argument 1 of type ‘unsigned char *’
    In file included from drivers/scsi/qedf/qedf.h:9,
    from drivers/scsi/qedf/qedf_main.c:23:
    ./include/scsi/libfcoe.h:252:5: note: in a call to function ‘fcoe_wwn_from_mac’
    252 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int);
    | ^~~~~~~~~~~~~~~~~

    by changing the array size to the correct value of ETH_ALEN in the
    argument declaration.

    Also, fix a couple of checkpatch warnings:
    WARNING: function definition argument 'unsigned int' should also have an identifier name

    This helps with the ongoing efforts to globally enable
    -Wstringop-overflow.

    Link: https://github.com/KSPP/linux/issues/181
    Fixes: 85b4aa4926a5 ("[SCSI] fcoe: Fibre Channel over Ethernet")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Sasha Levin

    Gustavo A. R. Silva
     
  • [ Upstream commit 565138ac5f8a5330669a20e5f94759764e9165ec ]

    These flags are supposed to be bit numbers. Right now they cause a double
    shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit
    numbers are small and it's done consistently so it does not cause an issue
    at run time.

    Link: https://lore.kernel.org/r/YmFyWHf8nrrx+SHa@kili
    Fixes: 5bd856256f8c ("scsi: iscsi: Merge suspend fields")
    Reviewed-by: Mike Christie
    Reviewed-by: Lee Duncan
    Signed-off-by: Dan Carpenter
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Dan Carpenter
     

27 Apr, 2022

3 commits

  • [ Upstream commit 44ac97109e42f87b1a34954704b81b6c8eca80c4 ]

    If a offload driver doesn't use the xmit workqueue, then when we are doing
    ep_disconnect libiscsi can still inject PDUs to the driver. This adds a
    check for if the connection is bound before trying to inject PDUs.

    Link: https://lore.kernel.org/r/20220408001314.5014-9-michael.christie@oracle.com
    Tested-by: Manish Rangankar
    Reviewed-by: Lee Duncan
    Reviewed-by: Chris Leech
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     
  • [ Upstream commit 5bd856256f8c03e329f8ff36d8c8efcb111fe6df ]

    Move the tx and rx suspend fields into one flags field.

    Link: https://lore.kernel.org/r/20220408001314.5014-8-michael.christie@oracle.com
    Tested-by: Manish Rangankar
    Reviewed-by: Lee Duncan
    Reviewed-by: Chris Leech
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     
  • [ Upstream commit 3c6ae371b8a1ffba1fc415989fd581ebf841ed0a ]

    We can't release the endpoint ID until all references to the endpoint have
    been dropped or it could be allocated while in use. This has us use an idr
    instead of looping over all conns to find a free ID and then free the ID
    when all references have been dropped instead of when the device is only
    deleted.

    Link: https://lore.kernel.org/r/20220408001314.5014-4-michael.christie@oracle.com
    Tested-by: Manish Rangankar
    Reviewed-by: Lee Duncan
    Reviewed-by: Chris Leech
    Reviewed-by: Wu Bo
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     

20 Apr, 2022

1 commit

  • [ Upstream commit 7c6e99c18167ed89729bf167ccb4a7e3ab3115ba ]

    If iscsid is doing a stop_conn at the same time the kernel is starting
    error recovery we can hit a race that allows the cleanup work to run on a
    valid connection. In the race, iscsi_if_stop_conn sees the cleanup bit set,
    but it calls flush_work on the clean_work before iscsi_conn_error_event has
    queued it. The flush then returns before the queueing and so the
    cleanup_work can run later and disconnect/stop a conn while it's in a
    connected state.

    The patch:

    Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
    kernel space")

    added the late stop_conn call bug originally, and the patch:

    Commit 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")

    attempted to fix it but only fixed the normal EH case and left the above
    race for the iscsid restart case. For the normal EH case we don't hit the
    race because we only signal userspace to start recovery after we have done
    the queueing, so the flush will always catch the queued work or see it
    completed.

    For iscsid restart cases like boot, we can hit the race because iscsid will
    call down to the kernel before the kernel has signaled any error, so both
    code paths can be running at the same time. This adds a lock around the
    setting of the cleanup bit and queueing so they happen together.

    Link: https://lore.kernel.org/r/20220408001314.5014-6-michael.christie@oracle.com
    Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space")
    Tested-by: Manish Rangankar
    Reviewed-by: Lee Duncan
    Reviewed-by: Chris Leech
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     

08 Apr, 2022

1 commit

  • commit af4edb1d50c6d1044cb34bc43621411b7ba2cffe upstream.

    Kernel messages produced during runtime PM can cause a never-ending cycle
    because user space utilities (e.g. journald or rsyslog) write the messages
    back to storage, causing runtime resume, more messages, and so on.

    Messages that tell of things that are expected to happen are arguably
    unnecessary, so add a flag to suppress them. This flag is used by the UFS
    driver.

    Link: https://lore.kernel.org/r/20220228113652.970857-2-adrian.hunter@intel.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Adrian Hunter
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     

19 Nov, 2021

1 commit

  • commit 5ae17501bc62a49b0b193dcce003f16375f16654 upstream.

    The changes to issue the abort from the scmd->abort_work instead of the EH
    thread introduced a problem if eh_deadline is used. If aborting the
    command(s) is successful, and there are never any scmds added to the
    shost->eh_cmd_q, there is no code path which will reset the ->last_reset
    value back to zero.

    The effect of this is that after a successful abort with no EH thread
    activity, a subsequent timeout, perhaps a long time later, might
    immediately be considered past a user-set eh_deadline time, and the host
    will be reset with no attempt at recovery.

    Fix this by resetting ->last_reset back to zero in scmd_eh_abort_handler()
    if it is determined that the EH thread will not run to do this.

    Thanks to Gopinath Marappan for investigating this problem.

    Link: https://lore.kernel.org/r/20211029194311.17504-2-emilne@redhat.com
    Fixes: e494f6a72839 ("[SCSI] improved eh timeout handler")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ewan D. Milne
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Ewan D. Milne
     

22 Sep, 2021

1 commit

  • The 'current_tag' field in struct scsi_device is unused now; remove it.

    Link: https://lore.kernel.org/r/1631696835-136198-4-git-send-email-john.garry@huawei.com
    Reviewed-by: Bart Van Assche
    Signed-off-by: Hannes Reinecke
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     

18 Aug, 2021

1 commit

  • It is never read, so get rid of it.

    Link: https://lore.kernel.org/r/1628862553-179450-4-git-send-email-john.garry@huawei.com
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    John Garry
     

12 Aug, 2021

4 commits

  • Link: https://lore.kernel.org/r/20210806040023.5355-2-martin.petersen@oracle.com
    Cc: Bart Van Assche
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Martin K. Petersen
     
  • Since all scsi_cmnd.request users are gone, remove the request pointer
    from struct scsi_cmnd.

    Link: https://lore.kernel.org/r/20210809230355.8186-53-bvanassche@acm.org
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Ming Lei
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • Prepare for removal of the request pointer by using scsi_cmd_to_rq()
    instead. Cast away constness where necessary when passing a SCSI command
    pointer to scsi_cmd_to_rq(). This patch does not change any functionality.

    Link: https://lore.kernel.org/r/20210809230355.8186-3-bvanassche@acm.org
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Ming Lei
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • The 'request' member of struct scsi_cmnd is superfluous. The struct request
    and struct scsi_cmnd data structures are adjacent and hence the request
    pointer can be derived easily from a scsi_cmnd pointer. Introduce a helper
    function that performs that conversion in a type-safe way. This patch is
    the first step towards removing the request member from struct
    scsi_cmnd. Making that change has the following advantages:

    - This is a performance optimization since adding an offset to a pointer
    takes less time than dereferencing a pointer.

    - struct scsi_cmnd becomes smaller.

    Link: https://lore.kernel.org/r/20210809230355.8186-2-bvanassche@acm.org
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Ming Lei
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     

31 Jul, 2021

2 commits

  • Move the sg_timeout and sg_reserved_size fields into the bsg_device and
    scsi_device structures as they have nothing to do with generic block I/O.
    Note that these values are now separate for bsg vs. SCSI device node
    access, but that just matches how /dev/sg vs the other nodes has always
    behaved.

    Link: https://lore.kernel.org/r/20210729064845.1044147-4-hch@lst.de
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     
  • Use the per-device cdev_device_interface to store the bsg data in the char
    device inode, and thus remove the need to embedd the bsg_class_device
    structure in the request_queue.

    Link: https://lore.kernel.org/r/20210729064845.1044147-2-hch@lst.de
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

29 Jul, 2021

5 commits


22 Jul, 2021

1 commit

  • Add a new flag for devices that erroneously establish MEDIUM MAY HAVE
    CHANGED unit attentions. Drivers can set this flag to make the SCSI
    layer ignore media change events during resume.

    [mkp: add "ignore" and add corresponding flag to struct scsi_device]

    Link: https://lore.kernel.org/r/20210704075403.147114-2-martin.kepplinger@puri.sm
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin Kepplinger
    Signed-off-by: Martin K. Petersen

    Martin Kepplinger
     

21 Jul, 2021

3 commits

  • scsi_get_lba() confusingly returned the block layer sector number expressed
    in units of 512 bytes. Now that we have a more aptly named
    scsi_get_sector() function, make scsi_get_lba() return the actual LBA.

    Link: https://lore.kernel.org/r/20210609033929.3815-13-martin.petersen@oracle.com
    Reviewed-by: Bart Van Assche
    Reviewed-by: Benjamin Block
    Signed-off-by: Martin K. Petersen
    Message-Id:

    Martin K. Petersen
     
  • Since scsi_get_lba() returns a sector_t value instead of the LBA, the name
    of that function is confusing. Introduce an identical function
    scsi_get_sector().

    Link: https://lore.kernel.org/r/20210513223757.3938-2-bvanassche@acm.org
    Link: https://lore.kernel.org/r/20210609033929.3815-11-martin.petersen@oracle.com
    Cc: Christoph Hellwig
    Cc: Ming Lei
    Cc: Hannes Reinecke
    Reviewed-by: Damien Le Moal
    Reviewed-by: Benjamin Block
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen
    Message-Id:

    Bart Van Assche
     
  • We are about to remove the request pointer from struct scsi_cmnd and that
    will complicate getting to the ref_tag via t10_pi_ref_tag() in the various
    drivers. Introduce a helper function to retrieve the reference tag so
    drivers will not have to worry about the details.

    Link: https://lore.kernel.org/r/20210609033929.3815-2-martin.petersen@oracle.com
    Reviewed-by: Bart Van Assche
    Reviewed-by: Benjamin Block
    Signed-off-by: Martin K. Petersen
    Message-Id:

    Martin K. Petersen
     

03 Jul, 2021

1 commit

  • Pull SCSI updates from James Bottomley:
    "This series consists of the usual driver updates (ufs, ibmvfc,
    megaraid_sas, lpfc, elx, mpi3mr, qedi, iscsi, storvsc, mpt3sas) with
    elx and mpi3mr being new drivers.

    The major core change is a rework to drop the status byte handling
    macros and the old bit shifted definitions and the rest of the updates
    are minor fixes"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (287 commits)
    scsi: aha1740: Avoid over-read of sense buffer
    scsi: arcmsr: Avoid over-read of sense buffer
    scsi: ips: Avoid over-read of sense buffer
    scsi: ufs: ufs-mediatek: Add missing of_node_put() in ufs_mtk_probe()
    scsi: elx: libefc: Fix IRQ restore in efc_domain_dispatch_frame()
    scsi: elx: libefc: Fix less than zero comparison of a unsigned int
    scsi: elx: efct: Fix pointer error checking in debugfs init
    scsi: elx: efct: Fix is_originator return code type
    scsi: elx: efct: Fix link error for _bad_cmpxchg
    scsi: elx: efct: Eliminate unnecessary boolean check in efct_hw_command_cancel()
    scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session()
    scsi: elx: efct: Fix error handling in efct_hw_init()
    scsi: elx: efct: Remove redundant initialization of variable lun
    scsi: elx: efct: Fix spelling mistake "Unexected" -> "Unexpected"
    scsi: lpfc: Fix build error in lpfc_scsi.c
    scsi: target: iscsi: Remove redundant continue statement
    scsi: qla4xxx: Remove redundant continue statement
    scsi: ppa: Switch to use module_parport_driver()
    scsi: imm: Switch to use module_parport_driver()
    scsi: mpt3sas: Fix error return value in _scsih_expander_add()
    ...

    Linus Torvalds
     

10 Jun, 2021

3 commits

  • Added RHBA and RPA attributes type and length.

    As per FC_GC_7 document section "Table 400 – Attribute Entry Types and
    associated Values" ASCII type attributes length can be vary from "4 to 256
    byte". If we keep all RHBA ASCII attributes length 256 then total length
    is going upto 2750, which is far more than 2048 (max frame size).

    In libfc we do have logic to split FCP commands but not for CT commands.
    Practically all version/names get covered with in 64 bytes except OS name,
    for that we need 128 bytes. Hence length of all RBHA ASCII attributes
    is reduced to 64 bytes and 128 bytes in case of OS name.

    RPA attributes total length is within frame size.

    Link: https://lore.kernel.org/r/20210603121623.10084-6-jhasan@marvell.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Javed Hasan
    Signed-off-by: Martin K. Petersen

    Javed Hasan
     
  • Add all attributes for RHBA and RPA registration.

    Fallback mechanism is added between RBHA V2 and RHBA V1 attributes. In case
    RHBA get fails for V2 attributes we fall back to V1 attribute registration.

    Link: https://lore.kernel.org/r/20210603121623.10084-4-jhasan@marvell.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Javed Hasan
    Signed-off-by: Martin K. Petersen

    Javed Hasan
     
  • As per the FC-GS-5 specification, attribute lengths of node_name and
    manufacturer should in range of "4 to 64 Bytes" only.

    Link: https://lore.kernel.org/r/20210603101404.7841-2-jhasan@marvell.com
    Fixes: e721eb0616f6 ("scsi: scsi_transport_fc: Match HBA Attribute Length with HBAAPI V2.0 definitions")
    CC: stable@vger.kernel.org
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Javed Hasan
    Signed-off-by: Martin K. Petersen

    Javed Hasan
     

03 Jun, 2021

3 commits


02 Jun, 2021

6 commits

  • Include Hannes' SCSI command result rework in the staging branch.

    [mkp: remove DRIVER_SENSE from mpi3mr]

    Signed-off-by: Martin K. Petersen

    Martin K. Petersen
     
  • For aborts, qedi needs to cleanup the FW then send the TMF from a worker
    thread. While it's doing these the cmd could complete normally and the TMF
    could time out. libiscsi would then complete the iscsi_task which will call
    into the driver to cleanup the driver level resources while it still might
    be accessing them for the cleanup/abort.

    This has iscsi_eh_abort keep the iscsi_task ref if the TMF times out, so
    qedi does not have to worry about if the task is being freed while in use
    and does not need to get its own ref.

    Link: https://lore.kernel.org/r/20210525181821.7617-18-michael.christie@oracle.com
    Reviewed-by: Lee Duncan
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • If we haven't done a unbind target call we can race where
    iscsi_conn_teardown wakes up the EH thread and then frees the conn while
    those threads are still accessing the conn ehwait.

    We can only do one TMF per session so this just moves the TMF fields from
    the conn to the session. We can then rely on the
    iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call
    to remove the target and it's devices, and know after that point there is
    no device or scsi-ml callout trying to access the session.

    Link: https://lore.kernel.org/r/20210525181821.7617-14-michael.christie@oracle.com
    Reviewed-by: Lee Duncan
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • There are a couple places where we could free the iscsi_cls_conn while it's
    still in use. This adds some helpers to get/put a refcount on the struct
    and converts an exiting user. Subsequent commits will then use the helpers
    to fix 2 bugs in the eh code.

    Link: https://lore.kernel.org/r/20210525181821.7617-11-michael.christie@oracle.com
    Reviewed-by: Lee Duncan
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
    kernel space") has the following regressions/bugs that this patch fixes:

    1. It can return cmds to upper layers like dm-multipath where that can
    retry them. After they are successful the fs/app can send new I/O to the
    same sectors, but we've left the cmds running in FW or in the net layer.
    We need to be calling ep_disconnect if userspace is not up.

    This patch only fixes the issue for offload drivers. iscsi_tcp will be
    fixed in separate commit because it doesn't have a ep_disconnect call.

    2. The drivers that implement ep_disconnect expect that it's called before
    conn_stop. Besides crashes, if the cleanup_task callout is called before
    ep_disconnect it might free up driver/card resources for session1 then they
    could be allocated for session2. But because the driver's ep_disconnect is
    not called it has not cleaned up the firmware so the card is still using
    the resources for the original cmd.

    3. The stop_conn_work_fn can run after userspace has done its recovery and
    we are happily using the session. We will then end up with various bugs
    depending on what is going on at the time.

    We may also run stop_conn_work_fn late after userspace has called stop_conn
    and ep_disconnect and is now going to call start/bind conn. If
    stop_conn_work_fn runs after bind but before start, we would leave the conn
    in a unbound but sort of started state where IO might be allowed even
    though the drivers have been set in a state where they no longer expect
    I/O.

    4. Returning -EAGAIN in iscsi_if_destroy_conn if we haven't yet run the in
    kernel stop_conn function is breaking userspace. We should have been doing
    this for the caller.

    Link: https://lore.kernel.org/r/20210525181821.7617-8-michael.christie@oracle.com
    Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space")
    Reviewed-by: Lee Duncan
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Subsequent commits allow the kernel to do ep_disconnect. In that case we
    will have to get a proper refcount on the ep so one thread does not delete
    it from under another.

    Link: https://lore.kernel.org/r/20210525181821.7617-7-michael.christie@oracle.com
    Reviewed-by: Lee Duncan
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie