1. 05 May, 2017 2 commits
    • Nicholas Bellinger's avatar
      iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement · 197b806a
      Nicholas Bellinger authored
      While testing modification of per se_node_acl queue_depth forcing
      session reinstatement via lio_target_nacl_cmdsn_depth_store() ->
      core_tpg_set_initiator_node_queue_depth(), a hung task bug triggered
      when changing cmdsn_depth invoked session reinstatement while an iscsi
      login was already waiting for session reinstatement to complete.
      
      This can happen when an outstanding se_cmd descriptor is taking a
      long time to complete, and session reinstatement from iscsi login
      or cmdsn_depth change occurs concurrently.
      
      To address this bug, explicitly set session_fall_back_to_erl0 = 1
      when forcing session reinstatement, so session reinstatement is
      not attempted if an active session is already being shutdown.
      
      This patch has been tested with two scenarios.  The first when
      iscsi login is blocked waiting for iscsi session reinstatement
      to complete followed by queue_depth change via configfs, and
      second when queue_depth change via configfs us blocked followed
      by a iscsi login driven session reinstatement.
      
      Note this patch depends on commit d36ad77f to handle multiple
      sessions per se_node_acl when changing cmdsn_depth, and for
      pre v4.5 kernels will need to be included for stable as well.
      Reported-by: default avatarGary Guo <ghg@datera.io>
      Tested-by: default avatarGary Guo <ghg@datera.io>
      Cc: Gary Guo <ghg@datera.io>
      Cc: <stable@vger.kernel.org> # v4.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      197b806a
    • Nicholas Bellinger's avatar
      target: Fix compare_and_write_callback handling for non GOOD status · a71a5dc7
      Nicholas Bellinger authored
      Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE
      status during COMMIT phase in commit 9b2792c3, the same bug exists
      for the READ phase as well.
      
      This would manifest first as a lost SCSI response, and eventual
      hung task during fabric driver logout or re-login, as existing
      shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref
      to reach zero.
      
      To address this bug, compare_and_write_callback() has been changed
      to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE
      as necessary to signal failure status.
      Reported-by: default avatarBill Borsari <wgb@datera.io>
      Cc: Bill Borsari <wgb@datera.io>
      Tested-by: default avatarGary Guo <ghg@datera.io>
      Cc: Gary Guo <ghg@datera.io>
      Cc: <stable@vger.kernel.org> # v4.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      a71a5dc7
  2. 03 May, 2017 1 commit
    • Xiubo Li's avatar
      tcmu: Recalculate the tcmu_cmd size to save cmd area memories · fe25cc34
      Xiubo Li authored
      For the "struct tcmu_cmd_entry" in cmd area, the minimum size
      will be sizeof(struct tcmu_cmd_entry) == 112 Bytes. And it could
      fill about (sizeof(struct rsp) - sizeof(struct req)) /
      sizeof(struct iovec) == 68 / 16 ~= 4 data regions(iov[4]) by
      default.
      
      For most tcmu_cmds, the data block indexes allocated from the
      data area will be continuous. And for the continuous blocks they
      will be merged into the same region using only one iovec. For
      the current code, it will always allocates the same number of
      iovecs with blocks for each tcmu_cmd, and it will wastes much
      memories.
      
      For example, when the block size is 4K and the DATA_OUT buffer
      size is 64K, and the regions needed is less than 5(on my
      environment is almost 99.7%). The current code will allocate
      about 16 iovecs, and there will be (16 - 4) * sizeof(struct
      iovec) = 192 Bytes cmd area memories wasted.
      
      Here adds two helpers to calculate the base size and full size
      of the tcmu_cmd. And will recalculate them again when it make sure
      how many iovs is needed before insert it to cmd area.
      Signed-off-by: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
      Acked-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      fe25cc34
  3. 02 May, 2017 20 commits
  4. 02 Apr, 2017 2 commits
    • Xiubo Li's avatar
      tcmu: Skip Data-Out blocks before gathering Data-In buffer for BIDI case · a5d68ba8
      Xiubo Li authored
      For the bidirectional case, the Data-Out buffer blocks will always at
      the head of the tcmu_cmd's bitmap, and before gathering the Data-In
      buffer, first of all it should skip the Data-Out ones, or the device
      supporting BIDI commands won't work.
      
      Fixed: 26418649 ("target/user: Introduce data_bitmap, replace
      		data_length/data_head/data_tail")
      Reported-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Tested-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
      Cc: stable@vger.kernel.org # 4.6+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      a5d68ba8
    • Nicholas Bellinger's avatar
      iscsi-target: Drop work-around for legacy GlobalSAN initiator · 1c99de98
      Nicholas Bellinger authored
      Once upon a time back in 2009, a work-around was added to support
      the GlobalSAN iSCSI initiator v3.3 for MacOSX, which during login
      did not propose nor respond to MaxBurstLength, FirstBurstLength,
      DefaultTime2Wait and DefaultTime2Retain keys.
      
      The work-around in iscsi_check_proposer_for_optional_reply()
      allowed the missing keys to be proposed, but did not require
      waiting for a response before moving to full feature phase
      operation.  This allowed GlobalSAN v3.3 to work out-of-the
      box, and for many years we didn't run into login interopt
      issues with any other initiators..
      
      Until recently, when Martin tried a QLogic 57840S iSCSI Offload
      HBA on Windows 2016 which completed login, but subsequently
      failed with:
      
          Got unknown iSCSI OpCode: 0x43
      
      The issue was QLogic MSFT side did not propose DefaultTime2Wait +
      DefaultTime2Retain, so LIO proposes them itself, and immediately
      transitions to full feature phase because of the GlobalSAN hack.
      However, the QLogic MSFT side still attempts to respond to
      DefaultTime2Retain + DefaultTime2Wait, even though LIO has set
      ISCSI_FLAG_LOGIN_NEXT_STAGE3 + ISCSI_FLAG_LOGIN_TRANSIT
      in last login response.
      
      So while the QLogic MSFT side should have been proposing these
      two keys to start, it was doing the correct thing per RFC-3720
      attempting to respond to proposed keys before transitioning to
      full feature phase.
      
      All that said, recent versions of GlobalSAN iSCSI (v5.3.0.541)
      does correctly propose the four keys during login, making the
      original work-around moot.
      
      So in order to allow QLogic MSFT to run unmodified as-is, go
      ahead and drop this long standing work-around.
      Reported-by: default avatarMartin Svec <martin.svec@zoner.cz>
      Cc: Martin Svec <martin.svec@zoner.cz>
      Cc: Himanshu Madhani <Himanshu.Madhani@cavium.com>
      Cc: Arun Easi <arun.easi@cavium.com>
      Cc: stable@vger.kernel.org # 3.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      1c99de98
  5. 31 Mar, 2017 5 commits
  6. 30 Mar, 2017 6 commits
  7. 19 Mar, 2017 4 commits