08 Jul, 2013

3 commits

  • The return value wasn't checked by any of the callers. Assuming this is
    correct behaviour, we can simplify some code by not bothering to
    generate it.

    nab: Add srpt_queue_data_in() + srpt_queue_tm_rsp() nops around
    srpt_queue_response() void return

    Signed-off-by: Joern Engel
    Signed-off-by: Nicholas Bellinger

    Joern Engel
     
  • Three have been checked for but were never set. Remove the dead code.
    Also renumbers the remaining ones to a) get rid of the holes after the
    removal and b) avoid a collision between TMR_FUNCTION_COMPLETE==0 and
    the uninitialized case. If we failed to set a code, we should rather
    fall into the default case then return success.

    Signed-off-by: Joern Engel
    Signed-off-by: Nicholas Bellinger

    Joern Engel
     
  • This patch addresses a bug where RDMA_CM_EVENT_DISCONNECTED may occur
    before the connection shutdown has been completed by rx/tx threads,
    that causes isert_free_conn() to wait indefinately on ->conn_wait.

    This patch allows isert_disconnect_work code to invoke rdma_disconnect
    when isert_disconnect_work() process context is started by client
    session reset before isert_free_conn() code has been reached.

    It also adds isert_conn->conn_mutex protection for ->state within
    isert_disconnect_work(), isert_cq_comp_err() and isert_free_conn()
    code, along with isert_check_state() for wait_event usage.

    (v2: Add explicit iscsit_cause_connection_reinstatement call
    during isert_disconnect_work() to force conn reset)

    Cc: stable@vger.kernel.org # 3.10+
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

07 Jul, 2013

2 commits

  • This patch moves ISCSI_OP_REJECT failures into iscsit_sequence_cmd()
    in order to avoid external iscsit_reject_cmd() reject usage for all
    PDU types.

    It also updates PDU specific handlers for traditional iscsi-target
    code to not reset the session after posting a ISCSI_OP_REJECT during
    setup.

    (v2: Fix CMDSN_LOWER_THAN_EXP for ISCSI_OP_SCSI to call
    target_put_sess_cmd() after iscsit_sequence_cmd() failure)

    Cc: Or Gerlitz
    Cc: Mike Christie
    Cc: stable@vger.kernel.org # 3.10+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch changes iscsit_add_reject() + iscsit_add_reject_from_cmd()
    usage to not sleep on iscsi_cmd->reject_comp to address a free-after-use
    usage bug in v3.10 with iser-target code.

    It saves ->reject_reason for use within iscsit_build_reject() so the
    correct value for both transport cases. It also drops the legacy
    fail_conn parameter usage throughput iscsi-target code and adds
    two iscsit_add_reject_cmd() and iscsit_reject_cmd helper functions,
    along with various small cleanups.

    (v2: Re-enable target_put_sess_cmd() to be called from
    iscsit_add_reject_from_cmd() for rejects invoked after
    target_get_sess_cmd() has been called)

    Cc: Or Gerlitz
    Cc: Mike Christie
    Cc: stable@vger.kernel.org # 3.10+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

04 Jul, 2013

1 commit


26 Jun, 2013

1 commit

  • This patch refactoring existing iscsit_send_text_rsp() in order
    to handle iscsi_text_rsp payloads in a transport specific manner.

    This includes the addition of iscsit_build_text_rsp() to build
    the response payload and initialize ISCSI_OP_TEXT_RSP.

    v2: Make iscsit_build_text_rsp() determine extra padding bytes, and
    drop legacy padding calculation for traditional iSCSI text
    responses within iscsit_send_text_rsp()

    Reported-by: Or Gerlitz
    Cc: Or Gerlitz
    Cc: Mike Christie
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

25 Jun, 2013

2 commits

  • This patch refactors ISCSI_OP_TEXT handling within iscsi-target in
    order to handle iscsi_text payloads in a transport specific manner.

    This includes splitting current iscsit_handle_text_cmd() into
    iscsit_setup_text_cmd() and iscsit_process_text_cmd() calls, and
    makes iscsit_handle_text_cmd be only used internally by traditional
    iscsi socket calls.

    Cc: Or Gerlitz
    Cc: Mike Christie
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch refactors ISCSI_OP_NOOP handling within iscsi-target in
    order to handle iscsi_nopout payloads in a transport specific manner.

    This includes splitting existing iscsit_handle_nop_out() into
    iscsit_setup_nop_out() and iscsit_process_nop_out() calls, and
    makes iscsit_handle_nop_out() be only used internally by traditional
    iscsi socket calls.

    Next update iser-target code to use new callers and add FIXME for
    the handling iscsi_nopout payloads. Also fix reject response handling
    in iscsit_setup_nop_out() to use proper iscsit_add_reject_from_cmd().

    v2: Fix uninitialized iscsit_handle_nop_out() payload_length usage (Fengguang)
    v3: Remove left-over dead code in iscsit_setup_nop_out() (DanC)

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

21 Jun, 2013

2 commits


14 Jun, 2013

2 commits

  • Instead of taking the buffer and length, update_and_write_aptpl() will
    allocate the buffer as needed, and then free it. Instead, the function
    takes an 'aptpl' boolean parameter.

    This enables us to remove memory alloc/frees from struct
    t10_pr_registration and other spots.

    There is a slight loss of functionality because each callsite doesn't get
    its own pr_debug any more, but this info can be cleaned via ftrace if
    necessary and I think the shorter code is worth it.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • It's only ever set to PR_APTPL_BUF_LEN, so we don't need a variable.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

31 May, 2013

1 commit


30 May, 2013

1 commit

  • Switch back to pre commit 1c7b13fe652 list splicing logic for active I/O
    shutdown with tcm_qla2xxx + ib_srpt fabrics.

    The original commit was done under the incorrect assumption that it's safe to
    walk se_sess->sess_cmd_list unprotected in target_wait_for_sess_cmds() after
    sess->sess_tearing_down = 1 has been set by target_sess_cmd_list_set_waiting()
    during session shutdown.

    So instead of adding sess->sess_cmd_lock protection around sess->sess_cmd_list
    during target_wait_for_sess_cmds(), switch back to sess->sess_wait_list to
    allow wait_for_completion() + TFO->release_cmd() to occur without having to
    walk ->sess_cmd_list after the list_splice.

    Also add a check to exit if target_sess_cmd_list_set_waiting() has already
    been called, and add a WARN_ON to check for any fabric bug where new se_cmds
    are added to sess->sess_cmd_list after sess->sess_tearing_down = 1 has already
    been set.

    Cc: Joern Engel
    Cc: Roland Dreier
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

21 May, 2013

1 commit


15 May, 2013

1 commit


04 May, 2013

1 commit


25 Apr, 2013

3 commits

  • Add basic struct iscsit_transport API template to allow iscsi-target for
    running with external transport modules using existing iscsi_target_core.h
    code.

    For all external modules, this calls try_module_get() and module_put()
    to obtain + release an external iscsit_transport module reference count.

    Also include the iscsi-target symbols necessary in iscsi_transport.h to
    allow external transport modules to function.

    v3 changes:
    - Add iscsit_build_reject export for ISTATE_SEND_REJECT usage

    v2 changes:

    - Drop unnecessary export of iscsit_get_transport + iscsit_put_transport (roland)
    - Add ->iscsit_queue_data_in() to remove extra context switch on RDMA_WRITE
    - Add ->iscsit_queue_status() to remove extra context switch on IB_SEND status
    - Add ->iscsit_get_dataout() to remove extra context switch on RDMA_READ
    - Drop ->iscsit_free_cmd()
    - Drop ->iscsit_unmap_cmd()
    - Rename iscsit_create_transport() -> iscsit_register_transport() (andy)
    - Rename iscsit_destroy_transport() -> iscsit_unregister_transport() (andy)

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Export target_get_sess_cmd() symbol so that it can be used by
    iscsi-target.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • iblock_execute_unmap() and fd_execute_unmap share a lot of code.
    Add sbc_execute_unmap() helper to remove duplicated code for
    iblock_execute_unmap() and fd_execute_unmap().

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Cc: Nicholas Bellinger
    Signed-off-by: Asias He
    Signed-off-by: Nicholas Bellinger

    Asias He
     

24 Feb, 2013

1 commit


14 Feb, 2013

6 commits

  • SBC-3 (revision 35) says:

    The PARAMETER LIST LENGTH field specifies the length in bytes of the
    UNMAP parameter list that is available to be transferred from the
    Data-Out Buffer. If the parameter list length is greater than zero
    and less than 0008h (i.e., eight), then the device server shall
    terminate the command with CHECK CONDITION status with the sense key
    set to ILLEGAL REQUEST and the additional sense code set to
    PARAMETER LIST LENGTH ERROR. A PARAMETER LIST LENGTH set to zero
    specifies that no data shall be sent.

    so our sense code for too-short descriptors was wrong, and we were
    incorrectly failing commands that didn't transfer any descriptors.

    While we're at it, also handle the UNMAP check:

    If the ANCHOR bit is set to one, and the ANC_SUP bit in the Logical
    Block Provisioning VPD page (see 6.6.4) is set to zero, then the
    device server shall terminate the command with CHECK CONDITION
    status with the sense key set to ILLEGAL REQUEST and the additional
    sense code set to INVALID FIELD IN CDB.

    (chris boot: Fix wrong cut+paste comment in transport_send_check_condition_and_sense)

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch changes LIO to use the configfs backend device name as the
    model if you echo '1' to an individual device's emulate_model_alias attribute.
    This is a valid operation only on devices with an export count of 0.

    Signed-off-by: Tregaron Bayly
    Signed-off-by: Nicholas Bellinger

    Tregaron Bayly
     
  • This patch allows IBLOCK to check block hints in request_queue->flush_flags
    when reporting current backend device WriteCacheEnabled status to a remote
    SCSI initiator port.

    This is done via a se_subsystem_api->get_write_cache() call instead of a
    backend se_device creation time flag, as we expect REQ_FLUSH bits to possibly
    change from an underlying blk_queue_flush() by the SCSI disk driver, or
    internal raw struct block_device driver usage.

    Also go ahead and update iblock_execute_rw() bio I/O path code to use
    REQ_FLUSH + REQ_FUA hints when determining WRITE_FUA usage, and make SPC
    emulation code use a spc_check_dev_wce() helper to handle both types of
    cases for virtual backend subsystem drivers.

    (asias: Drop unnecessary comparsion operators)

    Reported-by: majianpeng
    Cc: majianpeng
    Cc: Christoph Hellwig
    Cc: Jens Axboe
    Cc: James Bottomley
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • "buf" is 128 characters and "vpd->device_identifier" is 256. It makes
    the static checkers complain.

    Also bump VPD_TMP_BUF_SIZE to match INQUIRY_VPD_DEVICE_IDENTIFIER_LEN.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Dan Carpenter
     
  • Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • Some target drivers might need to access the inquiry data
    directly, without sending out the actual command.
    So export these functions.

    Signed-off-by: Hannes Reinecke
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     

11 Jan, 2013

1 commit


14 Dec, 2012

1 commit

  • Thanks for reviews, looking a lot better.

    ---- 8< ----

    Initiator access config could be easier. The way other storage vendors
    have addressed this is to support initiator groups: the admin adds
    initiator WWNs to the group, and then LUN permissions can be granted for
    the entire group at once.

    Instead of changing ktarget's configfs interface, this patch keeps
    the configfs interface per-initiator-wwn and just adds a 'tag' field
    for each. This should be enough for user tools like targetcli to group
    initiator ACLs and sync their configurations.

    acl_tag is not used internally, but needs to be kept in configfs so that
    all user tools can avoid dependencies on each other.

    Code tested to work, although userspace pieces still to be implemented.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

05 Dec, 2012

1 commit

  • This patch adds [dev,lun]_link_magic value assignment + checks within generic
    target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure
    destination config_item *target_item sent from configfs_symlink() ->
    config_item_operations->allow_link() is the underlying se_device->dev_group
    and se_lun->lun_group that we expect to symlink.

    Reported-by: Sebastian Andrzej Siewior
    Cc: Sebastian Andrzej Siewior
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

28 Nov, 2012

1 commit

  • We already expect TFO->get_blocks() to return sector_t for zero value case
    when doing WRITE_SAME to the end of the backend device, so go ahead and return
    sector_t from spc_get_write_same_sectors() to handle this case properly.

    Also, update the single iblock_execute_write_same() caller of this code.

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

16 Nov, 2012

2 commits

  • This patch adds a new max_write_same_len device attribute for use with
    WRITE_SAME w/ UNMAP=0 backend emulation. This can be useful for
    lowering the default backend value (IBLOCK uses 0xFFFF).

    Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to
    report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during
    sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated
    WRITE_SAME w/ UNMAP=0 cases.

    (Robert: Move max_write_same_len check in sbc_setup_write_same() to
    check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases)

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Cc: Robert Elliott
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds a new sbc_ops->execute_write_same_unmap() caller for use
    with WRITE_SAME w/ UNMAP=1, and performs the ->execute_cmd() setup based
    this bit within sbc_setup_write_same() code.

    Also, makes the changes in sbc_parse_cdb() to handle a sense_reason_t
    return from sbc_setup_write_same() on error.

    Reported-by: Christoph Hellwig
    Cc: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

07 Nov, 2012

6 commits

  • Pass the sense reason as an explicit return value from the I/O submission
    path instead of storing it in struct se_cmd and using negative return
    values. This cleans up a lot of the code pathes, and with the sparse
    annotations for the new sense_reason_t type allows for much better
    error checking.

    (nab: Convert spc_emulate_modesense + spc_emulate_modeselect to use
    sense_reason_t with Roland's MODE SELECT changes)

    Signed-off-by: Christoph Hellwig
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Now that the reservations and ALUA code have been cleaned up there is no need
    for the get_device_rev method, as we only need the standards revision in the
    inquiry data, where we can hardcode it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • We always support ALUA for virtual backends, and never for physical ones. Simplify
    the code to just deal with these two cases and remove the superflous abstractions.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • We do not support host-level reservations for the pscsi backend, and all
    virtual backends are newere than SCSI-2, so just make the combined
    SPC-3 + SCSI-2 support the only supported variant and kill the switches
    for the different implementations, given that this code handles the no-op
    version just fine.

    (hch: Update DRF_SPC2_RESERVATIONS lock usage)

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • We can just key off ordered tag emulation of the transport_type field.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig