08 Sep, 2012

1 commit

  • Similar to INQUIRY and MODE SENSE, construct the sense data in a
    buffer and later copy it to the scatterlist. Do not do anything,
    but still clear a pending unit attention condition, if the allocation
    length is zero.

    However, SPC tells us that "If a REQUEST SENSE command is terminated with
    CHECK CONDITION status [and] the REQUEST SENSE command was received on
    an I_T nexus with a pending unit attention condition (i.e., before the
    device server reports CHECK CONDITION status), then the device server
    shall not clear the pending unit attention condition." Do the
    transport_kmap_data_sg early to detect this case.

    It also tells us "Device servers shall not adjust the additional sense
    length to reflect truncation if the allocation length is less than the
    sense data available", so do not do that! Note that the err variable
    is write-only.

    Signed-off-by: Paolo Bonzini
    Signed-off-by: Nicholas Bellinger

    Paolo Bonzini
     

06 Sep, 2012

1 commit

  • The pointer to the sense buffer is fetched by transport_get_sense_data,
    but this is called by target_complete_ok_work long after pscsi_req_done
    has freed the struct that contains it.

    Pass instead the fabric's sense buffer to transport_complete,
    and copy the data to it directly in transport_complete. Setting
    SCF_TRANSPORT_TASK_SENSE also becomes a duty of transport_complete.

    Signed-off-by: Paolo Bonzini
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Paolo Bonzini
     

22 Aug, 2012

1 commit


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

17 commits

  • Many SCSI commands are defined to return a CHECK CONDITION / ILLEGAL
    REQUEST with ASC set to LOGICAL BLOCK ADDRESS OUT OF RANGE if the
    initiator sends a command that accesses a too-big LBA. Add an enum
    value and case entries so that target code can return this status.

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

    Roland Dreier
     
  • 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
     
  • The last functionality of the target processing thread is offloading possibly
    long running task management requests from the submitter context. To keep
    TMR semantics the same we need a single threaded ordered queue, which can
    be provided by a per-device workqueue with the right flags.

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

    Christoph Hellwig
     
  • 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
     
  • Having all the unmap payload parsing in the backed is a bit ugly, but until
    more drivers support it and we can find a good interface for all of them
    that seems the way to go.

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

    Christoph Hellwig
     
  • Add spc_ops->execute_write_same() caller for ->execute_cmd() setup,
    and update IBLOCK backends to use it.

    (nab: add export of spc_get_write_same_sectors symbol)
    (roland: Carry forward: Fix range calculation in WRITE SAME emulation
    when num blocks == 0)

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

    Christoph Hellwig
     
  • Add spc_ops->execute_sync_cache() caller for ->execute_cmd() setup,
    and update IBLOCK + FILEIO backends to use it.

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

    Christoph Hellwig
     
  • Remove the execute_cmd method in struct se_subsystem_api, and always use the
    one directly in struct se_cmd. To make life simpler for SBC virtual backends
    a struct spc_ops that is passed to sbc_parse_cmd is added. For now it
    only contains an execute_rw member, but more will follow with the subsequent
    commits.

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

    Christoph Hellwig
     
  • Remove the dead SCF_SE_ALLOW_EOO and SCF_DELAYED_CMD_FROM_SAM_ATTR
    from se_cmd_flags_table.

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

    Christoph Hellwig
     
  • Also remove the unused ref_task_lun field in struct se_tmr_req.

    (nab: Add missing TASK_REASSIGN ref_lun vs. ref_cmd orig_fe_lun checks
    in iscsit_tmr_task_reassign)

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

    Christoph Hellwig
     
  • Since "target: Drop se_device TCQ queue_depth usage from I/O path" we always
    submit all commands (or back then, tasks) from __transport_execute_tasks.

    That means the the execute list has lots its purpose, as we can simply
    submit the commands that are restarted in transport_complete_task_attr
    directly while we walk the list. In fact doing so also solves a race
    in the way it currently walks to delayed_cmd_list as well.

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

    Christoph Hellwig
     
  • Move the existing code in target_core_cdb.c into the files for the command
    sets that the emulations implement.

    (roland + nab: Squash patch: Fix range calculation in WRITE SAME emulation
    when num blocks == 0s)

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

    Christoph Hellwig
     
  • Instead of trying to handle all SCSI command sets in one function
    (transport_generic_cmd_sequencer) call out to the backend driver to perform
    this functionality. For pSCSI a copy of the existing code is used, but for
    all virtual backends we can use a new parse_sbc_cdb helper is used to
    provide a simple SBC emulation.

    For now this setups means a fair amount of duplication between pSCSI and the
    SBC library, but patches later in this series will sort out that problem.

    (nab: Fix up build failure in target_core_pscsi.c)

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

    Christoph Hellwig
     
  • We don't need three flags to classifiy the CDB as we can check for a NULL S/G
    list for a dataless command, and can infer from the absence of the data flag
    that we deal with a control CDB. Also remove the _SG_IO from the data CDB
    flag as all I/O is dont on S/G lists now.

    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
     

17 May, 2012

1 commit

  • This patch adds support for ALUA MI_REPORT_TARGET_PGS extended header
    format defined within SPC-4. It changes target core ALUA emulation logic
    within target_emulate_report_target_port_groups() to support both the
    extended and original length only header formats.

    It includes adding a new 'implict_trans_secs' attribute for each ALUA
    target port group to control the value returned to the application client
    for an recommended implict translation timeout in seconds. By default
    this value is currently set to zero, and limited up to 255 by virtue of
    using a single byte in the extended header format.

    This value is used by target_emulate_report_target_port_groups() within
    the extended header logic to set IMPLICIT TRANSITION TIME as defined by
    spc4r30.

    Cc: Hannes Reinecke
    Cc: Rob Evers
    Cc: Christoph Hellwig
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

12 May, 2012

1 commit


10 May, 2012

1 commit

  • This patch removes the original usage of dev_attr->max_sectors in favor of
    dev_attr->hw_max_sectors that is now being enforced by target core from
    within transport_generic_cmd_sequencer() for SCF_SCSI_DATA_SG_IO_CDB ops.

    After the recent se_task removal patches from hch, this value for IBLOCK
    backends being set via configfs by userspace from an saved max_sectors
    value that is turning out to be problematic, so it makes sense to go ahead
    and remove this now legacy attribute all-together.

    This patch also continues to make se_dev_set_default_attribs() do
    (sectors / block_size) alignment for what actually get used by
    target_core_mod to be safe here, following the same alignment currently
    used by fabric_max_sectors.

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

    Nicholas Bellinger
     

07 May, 2012

11 commits


15 Apr, 2012

4 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
     
  • The UASP protocol does not inform the target device upfront how much
    data it should expect so we have to learn in from the CDB. So in order
    to handle this case, add a TARGET_SCF_UNKNOWN_SIZE to target_submit_cmd()
    and perform an explictly assignment for se_cmd->data_length from the
    extracted CDB size in transport_generic_cmd_sequencer().

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Nicholas Bellinger

    Sebastian Andrzej Siewior
     
  • This was used at one time as a hack by FILEIO backend registration to
    allow a struct block_device that was claimed with blkdev_get (by a local
    filesystem mount for example) to be exported as read-only (SCSI WP=1).

    Since FILEIO backend registration will no longer attempt to obtain
    exclusive access to an underlying struct block_device here, this flag is
    now obsolete.

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

    Nicholas Bellinger