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
     

07 Nov, 2012

1 commit

  • 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
     

03 Oct, 2012

1 commit

  • This patch adds a new target_submit_cmd_map_sgls() to pass pre-allocated
    SGL memory using transport_generic_map_mem_to_cmd() logic into the generic
    target submit I/O codepath.

    It also adds a target_submit_cmd() wrapper around target_submit_cmd_map_sgls()
    for existing fabric code that already assumes internal target-core SGL memory
    allocation.

    (v2: Rename to target_submit_cmd_map_sgls + drop TARGET_SCF_MAP_MEM flag
    in favor of non zero sgl_count check)

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

    Nicholas Bellinger
     

18 Sep, 2012

2 commits

  • Every fabric driver has to supply a se_tfo->set_fabric_sense_len()
    method, just so iSCSI can return an offset of 2. However, every fabric
    driver is already allocating a sense buffer and passing it into the
    target core, either via transport_init_se_cmd() or target_submit_cmd().

    So instead of having iSCSI pass the start of its sense buffer into the
    core and then later tell the core to skip the first 2 bytes, it seems
    easier for iSCSI just to do the offset of 2 when it passes the sense
    buffer into the core. Then we can drop the se_tfo->set_fabric_sense_len()
    everywhere, and just add a couple of lines of code to iSCSI to set the
    sense data length to the beginning of the buffer right before it sends
    it over the network.

    (nab: Remove .set_fabric_sense_len usage from tcm_qla2xxx_npiv_ops +
    change transport_get_sense_buffer to follow v3.6-rc6 code w/o
    ->set_fabric_sense_len usage)

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

    Roland Dreier
     
  • There are no callers of se_tfo->get_fabric_sense_len(), so we should
    stop having every fabric driver implement it.

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

    Roland Dreier
     

18 Jul, 2012

1 commit

  • We want it to be possible for target_submit_cmd() to return errors up
    to its fabric module callers. For now just update the prototype to
    return an int, and update all callers to handle non-zero return values
    as an error.

    This is immediately useful for tcm_qla2xxx to fix a long-standing active
    I/O session shutdown race, but tcm_fc, usb-gadget, and sbp-target the
    fabric maintainers need to check + ACK that handling a target_submit_cmd()
    failure due to session shutdown does not introduce regressions

    (nab: Respin against for-next after initial NACK + update docbook comment +
    fix double se_cmd init in exception path for usb-gadget)

    Cc: Chad Dupuis
    Cc: Arun Easi
    Cc: Chris Boot
    Cc: Stefan Richter
    Cc: Mark Rustad
    Cc: Sebastian Andrzej Siewior
    Cc: Felipe Balbi
    Cc: Andy Grover
    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     

17 Jul, 2012

5 commits

  • Since we set se_session.sess_tearing_down and stop new commands from
    being added to se_session.sess_cmd_list before we wait for commands to
    finish when freeing a session, there's no need for a separate
    sess_wait_list -- if we let new commands be added to sess_cmd_list
    after setting sess_tearing_down, that would be a bug that breaks the
    logic of waiting in-flight commands.

    Also rename target_splice_sess_cmd_list() to
    target_sess_cmd_list_set_waiting(), since we are no longer splicing
    onto a separate list.

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

    Roland Dreier
     
  • There are no in-tree users of target_get_sess_cmd() outside of
    target_core_transport.c. Any new code should use the higher-level
    target_submit_cmd() interface. So let's un-export target_get_sess_cmd()
    and make it static to the one file where it's actually used.

    (nab: Fix up minor fuzz to for-next)

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

    Roland Dreier
     
  • Remove this command submission path which is not used by any in-tree driver.
    This also removes the now unused new_cmd_map fabtric method, which a few
    drivers implemented despite never calling transport_generic_handle_cdb_map.

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

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

    Christoph Hellwig
     
  • Just call target_execute_cmd directly. Also, convert loopback, sbp,
    usb-gadget to use the newly exported target_execute_cmd().

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

    Christoph Hellwig
     

13 Jun, 2012

1 commit

  • This patch adds an optional target_core_fabric_ops->put_session() caller
    within the existing target_put_session() code path.

    This is required by tcm_qla2xxx code in order to invoke it's own fabric
    specific session shutdown handler using se_session->sess_kref.

    Signed-off-by: Joern Engel
    Cc: Roland Dreier
    Cc: Arun Easi
    Signed-off-by: Nicholas Bellinger

    Joern Engel
     

12 May, 2012

1 commit


15 Apr, 2012

2 commits

  • This patch renames a horribly misnamed function that no longer allocate
    tasks to something more descriptive for it's modern use in target core.

    (nab: Fix up ib_srpt to use this as well ahead of a target_submit_cmd
    conversion)

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

    Andy Grover
     
  • Now that all fabrics are converted over to using se_cmd->t_data_sg
    directly, we can drop the task sg chaining support. With the modern
    memory allocation in target core, task sg chaining is needless
    overhead -- we would split up the main cmd sglist into pieces, and
    then splice those pieces back together instead of just using the
    original list directly.

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

    Roland Dreier
     

11 Mar, 2012

3 commits

  • This patch drops the following unused legacy API callers from target_core_fabric.h:

    *) TFO->fall_back_to_erl0()
    *) TFO->stop_session()
    *) TFO->sess_logged_in()
    *) TFO->is_state_remove()

    This patch also removes the stub usage in loopback, tcm_fc, iscsi_target,
    and ib_srpt fabric modules.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds se_node_acl->acl_kref for use with ->acl_free_comp
    during explict se_node_acl release. It adds kref_init() during
    se_node_acl setup, kref_get() during __transport_register_session()
    -> target_put_nacl() with existing transport_deregister_session()
    fabric callback usage.

    It also moves transport_free_session() to release *se_sess memory
    after target_put_nacl() execution in transport_deregister_session()

    Cc: Roland Dreier
    Cc: Christoph Hellwig
    Cc: Joern Engel
    Cc: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds basic se_session->sess_kref and get/put helpers for fabric
    session reference counting. It sets the initial kref in transport_init_session()
    and adds a target_release_session() callback to invoke TFO->close_session()
    for final session shutdown.

    Cc: Roland Dreier
    Cc: Christoph Hellwig
    Cc: Joern Engel
    Cc: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

26 Feb, 2012

5 commits

  • This patch allows target_submit_tmr() to pass gfp_t for se_cmd->se_tmr_req
    allocation, and also set up se_cmd->se_tmr_req->ref_task_tag for passed
    tag with TMR_ABORT_TASK.

    Also update tcm_fc(fcoe) parameter usgae and add ref_task_tag FIXME
    for TMR_ABORT_TASK usage,

    Cc: Andy Grover
    Cc: Kiran Patil
    Cc: Arun Easi
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch makes target_submit_tmr() se_tmr_req allocation occur before
    target_get_sess_cmd(), and changes target_submit_tmr() to return a failure
    w/ non zero status to the fabric caller upon core_tmr_alloc_req() failure.

    Cc: Andy Grover
    Cc: Kiran Patil
    Cc: Arun Easi
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • transport_generic_request_failure() is a wrapper around calling
    transport_send_check_condition_and_sense() that is required once
    an se_cmd->cmd_kref has been obtained via target_submit_cmd() ->
    target_get_sess_cmd().

    tcm_qla2xxx currently requires this, and since it's necessary for
    other callers using target_submit_cmd() make it exportable now.

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

    Nicholas Bellinger
     
  • Similar to target_submit_cmd, this function lets fabrics call one function
    (albeit with a lot of parameters) instead of 3 or more.

    (nab: Add missing return for transport_lookup_tmr_lun failure)

    Signed-off-by: Andy Grover
    Cc: Kiran Patil
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Change the test for if a cmd is a tmr request to checking if
    SCF_SCSI_TMR_CDB (a new flag) is set in cmd->se_cmd_flags.

    Also remove se_tmr_req_cache usage in favor of kzalloc usage,
    and make core_tmr_alloc_req() return int + setup se_cmd->se_tmr_req
    directly and fix up various fabric module usages

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

    Andy Grover
     

07 Feb, 2012

1 commit

  • Retval not very useful, and may even be harmful. Once submitted, fabrics
    should expect a sense error if anything goes wrong. All fabrics checking
    of this retval are useless or broken:

    fc checks it just to emit more debug output.
    ib_srpt trickles retval up, then it is ignored.
    qla2xxx trickles it up, which then causes a bug because the abort goto
    in qla_target.c thinks cmd hasn't been sent to target.

    Just returning nothing is best.

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

    Andy Grover
     

14 Dec, 2011

3 commits

  • Remove the now unused target_core_fabric_ops->check_release_cmd() as
    target_core handles this directly for se_cmd->cmd_kref objects now.

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

    Nicholas Bellinger
     
  • This patch adds a target_submit_cmd() caller that can be used by fabrics
    to submit an uninitialized se_cmd descriptor to an struct se_session +
    unpacked_lun from workqueue process context. This call will invoke the
    following steps:

    - transport_init_se_cmd() to setup se_cmd specific pointers
    - Obtain se_cmd->cmd_kref references with target_get_sess_cmd()
    - set se_cmd->t_tasks_bidi
    - transport_lookup_cmd_lun() to setup struct se_cmd->se_lun from
    the passed unpacked_lun
    - transport_generic_allocate_tasks() to setup the passed *cdb, and
    - transport_handle_cdb_direct() handle READ dispatch or WRITE
    ready-to-transfer callback to fabric

    v2 changes from hch feedback:

    *) Add target_sc_flags_table for target_submit_cmd flags
    *) Rename bidi parameter to flags, add TARGET_SCF_BIDI_OP
    *) Convert checks to BUG_ON
    *) Add out_check_cond for transport_send_check_condition_and_sense
    usage

    v3 changes:

    *) Add TARGET_SCF_ACK_KREF for target_submit_cmd into
    target_get_sess_cmd to determine when the fabric caller is expecting
    a second kref_put() from fabric packet acknowledgement.

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

    Nicholas Bellinger
     
  • This reorganized the headers under include/target into:

    - target_core_base.h stays as is with all target-wide data stuctures and defines
    - target_core_backend.h contains the whole interface to I/O backends
    - target_core_fabric.h contains the whole interface to fabric modules

    Except for those only the various configfs macro headers stay around.

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

    Christoph Hellwig