21 Nov, 2013

2 commits


14 Nov, 2013

1 commit


13 Nov, 2013

1 commit

  • In addition to block size (already implemented), passing through
    alignment offset, logical-to-phys block exponent, I/O granularity and
    optimal I/O length will allow initiators to properly handle layout on
    LUNs with 4K block sizes.

    Tested with various weird values via scsi_debug module.

    One thing to look at with this patch is the new block limits values --
    instead of granularity 1 optimal 8192, Lio will now be returning whatever
    the block device says, which may affect performance.

    Signed-off-by: Andy Grover
    Acked-by: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

09 Nov, 2013

1 commit


08 Nov, 2013

2 commits

  • Now with percpu refcounting for se_lun in place, go ahead and drop
    the legacy per se_cmd accounting for se_lun shutdown.

    This includes __transport_clear_lun_from_sessions(), the associated
    transport_lun_wait_for_tasks() logic, along with a handful of now
    unused se_cmd structure members and ->transport_state bits.

    Cc: Kent Overstreet
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds percpu refcounting for se_lun access that allows the
    association of an se_lun + se_cmd in transport_lookup_cmd_lun() to
    occur without an extra list_head for tracking outstanding I/O during
    se_lun shutdown.

    This effectively changes se_lun shutdown logic to wait for outstanding
    I/O percpu references to complete in transport_lun_remove_cmd() using
    se_lun->lun_ref_comp, instead of explicitly draining the per se_lun
    command list and waiting for individual se_cmd descriptor processing
    to complete.

    Cc: Kent Overstreet
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

24 Oct, 2013

1 commit


17 Oct, 2013

2 commits


11 Sep, 2013

7 commits

  • Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds the Third Party Copy (3PC) bit to signal support
    for EXTENDED_COPY within standard inquiry response data.

    Also add emulate_3pc device attribute in configfs (enabled by default)
    to allow the exposure of this bit to be disabled, if necessary.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: Roland Dreier
    Cc: Zach Brown
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for EXTENDED_COPY emulation from SPC-3, that
    enables full copy offload target support within both a single virtual
    backend device, and across multiple virtual backend devices. It also
    functions independent of target fabric, and supports copy offload
    across multiple target fabric ports.

    This implemenation supports both EXTENDED_COPY PUSH and PULL models
    of operation, so the actual CDB may be received on either source or
    desination logical unit.

    For Target Descriptors, it currently supports the NAA IEEE Registered
    Extended designator (type 0xe4), which allows the reference of target
    ports to occur independent of fabric type using EVPD 0x83 WWNs.

    For Segment Descriptors, it currently supports copy from block to
    block (0x02) mode.

    It also honors any present SCSI reservations of the destination target
    port. Note that only Supports No List Identifier (SNLID=1) mode is
    supported.

    Also included is basic RECEIVE_COPY_RESULTS with service action type
    OPERATING PARAMETERS (0x03) required for SNLID=1 operation.

    v3 changes:
    - Fix incorrect return type in target_do_receive_copy_results()
    (Fengguang)

    v2 changes:
    - Use target_alloc_sgl() instead of transport_generic_get_mem()
    - Convert debug output to use pr_debug()
    - Convert target_xcopy_parse_target_descriptors() NAA IEEN WWN
    dump to use 0x%16phN format specification
    - Drop unnecessary xcopy_pt_cmd->xpt_passthrough_wsem, and
    associated usage in xcopy_pt_write_pending() and
    target_xcopy_issue_pt_cmd()
    - Add check for unsupported EXTENDED_COPY(LID4) service action
    bits in target_do_xcopy()

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: Roland Dreier
    Cc: Zach Brown
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • EXTENDED_COPY needs to be able to search a global list of devices
    based on NAA WWN device identifiers, so add a simple g_device_list
    protected by g_device_mutex.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: Roland Dreier
    Cc: Zach Brown
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Both target_alloc_sgl() and transport_generic_map_mem_to_cmd() are
    required by EXTENDED_COPY logic when setting up internally dispatched
    command descriptors, so go ahead and make both of these non static.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: Roland Dreier
    Cc: Zach Brown
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Reversing the dma_data_direction for pci_map_sg() friends is useful
    for other drivers, so move it from tcm_qla2xxx into inline code
    within target_core_fabric.h.

    Also drop internal usage of equivlient in tcm_qla2xxx fabric code.

    Reported-by: Christoph Hellwig
    Cc: Roland Dreier
    Cc: Giridhar Malavali
    Cc: Chad Dupuis
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for COMPARE_AND_WRITE emulation on a per block
    basis. This logic is used as an atomic test and set primative currently
    used by VMWare ESX VAAI for performing array side locking of individual
    VMFS extent ownership.

    This includes the COMPARE_AND_WRITE CDB parsing within sbc_parse_cdb(),
    and does the majority of the work within the compare_and_write_callback()
    to perform the verify instance user data comparision, and subsequent
    write instance user data I/O submission upon a successfull comparision.

    The synchronization is enforced by se_device->caw_sem, that is obtained
    before the initial READ I/O submission in sbc_compare_and_write(). The
    mutex is then released upon MISCOMPARE in compare_and_write_callback(),
    or upon WRITE instance user-data completion in compare_and_write_post().

    The implementation currently assumes a single logical block (NoLB=1).

    v4 changes:
    - Explicitly clear cmd->transport_complete_callback for two failure
    cases in sbc_compare_and_write() in order to avoid double unlock
    of ->caw_sem in compare_and_write_callback() (Dan Carpenter)

    v3 changes:
    - Convert se_device->caw_mutex to ->caw_sem

    v2 changes:
    - Set SCF_COMPARE_AND_WRITE and cmd->execute_cmd() to
    sbc_compare_and_write() during setup in sbc_parse_cdb()
    - Use sbc_compare_and_write() for initial READ submission with
    DMA_FROM_DEVICE
    - Reset cmd->execute_cmd() to sbc_execute_rw() for write instance
    user-data in compare_and_write_callback()
    - Drop SCF_BIDI command flag usage
    - Set TRANSPORT_PROCESSING + transport_state flags before write
    instance submission, and convert to __target_execute_cmd()
    - Prevent sbc_get_size() from being being called twice to
    generate incorrect size in sbc_parse_cdb()
    - Enforce se_device->caw_mutex synchronization between initial
    READ I/O submission, and final WRITE I/O completion.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

10 Sep, 2013

8 commits

  • This patch adds the MAXIMUM COMPARE AND WRITE LENGTH bit, currently
    hardcoded to a single logical block (NoLB=1) within the Block Limits
    VPD in spc_emulate_evpd_b0().

    Also add emulate_caw device attribute in configfs (enabled by default)
    to allow the exposure of this bit to be disabled, if necessary.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Required by COMPARE_AND_WRITE for write instance user-data
    submission, in order to bypass target_execute_cmd() checks.

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

    Nicholas Bellinger
     
  • After COMPARE_AND_WRITE completes it's comparision, the WRITE
    payload SGLs head expect to be updated to point from the verify
    instance of user data, to the write instance of user data.

    So for this special case, add transport_reset_sgl_orig() usage
    within transport_free_pages() and add se_cmd->t_data_[sg,nents]_orig
    members to save the original assignments.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • COMPARE_AND_WRITE expects to be able to send down a DMA_FROM_DEVICE
    to obtain the necessary READ payload for comparision against the
    first half of the WRITE payload containing the verify user data.

    Currently virtual backends expect to internally reference SGLs,
    SGL nents, and data_direction, so change IBLOCK, FILEIO and RD
    sbc_ops->execute_rw() to accept this values as function parameters.

    Also add default sbc_execute_rw() handler for the typical case for
    cmd->execute_rw() submission using cmd->t_data_sg, cmd->t_data_nents,
    and cmd->data_direction).

    v2 Changes:
    - Add SCF_COMPARE_AND_WRITE command flag
    - Use sbc_execute_rw() for normal cmd->execute_rw() submission
    with expected se_cmd members.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds TCM_MISCOMPARE_VERIFY (ASC=0x1d, ASCQ=0x00) sense
    handling to transport_send_check_condition_and_sense(), which is
    required for a COMPARE_AND_WRITE comparision failure.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds a sense_reason_t return to ->transport_complete_callback(),
    and updates target_complete_ok_work() to invoke the call if necessary to
    transport_send_check_condition_and_sense() during the failure case.

    Also update xdreadwrite_callback() to use this return value.

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin Petersen
    Cc: Chris Mason
    Cc: James Bottomley
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This command converts iscsi/isert-target to use allocations based on
    iscsit_transport->priv_size within iscsit_allocate_cmd(), instead of
    using an embedded isert_cmd->iscsi_cmd.

    This includes removing iscsit_transport->alloc_cmd() usage, along
    with updating isert-target code to use iscsit_priv_cmd().

    Also, remove left-over iscsit_transport->release_cmd() usage for
    direct calls to iscsit_release_cmd(), and drop the now unused
    lio_cmd_cache and isert_cmd_cache.

    Cc: Or Gerlitz
    Cc: Kent Overstreet
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds lib/idr.c based transport_init_session_tags() logic
    that allows fabric drivers to setup a per-cpu se_sess->sess_tag_pool
    and associated se_sess->sess_cmd_map for basic tagged pre-allocation
    of fabric descriptor sized memory.

    v5 changes:
    - Convert to percpu_ida.h include

    v4 changes:
    - Add transport_alloc_session_tags() for fabrics that need early
    transport_init_session()

    v3 changes:
    - Update to percpu-ida usage

    Cc: Kent Overstreet
    Cc: Asias He
    Cc: Michael S. Tsirkin
    Reviewed-by: Asias He
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

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