06 Dec, 2011

11 commits

  • Some are never used, some are set but never read, dev_hoq_count is
    incremented and decremented, but never read.

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

    Jörn Engel
     
  • SBC-3 says:

    A TRANSFER LENGTH field set to zero specifies that 256 logical
    blocks shall be written. Any other value specifies the number
    of logical blocks that shall be written.

    The old code was always just returning the value in the TRANSFER LENGTH
    byte. Fix this to return 256 if the byte is 0.

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

    Roland Dreier
     
  • IO commands with a TRANSFER LENGTH of 0 are not an error; for example,
    for READ (10) and WRITE (10), SBC-3 says:

    A TRANSFER LENGTH field set to zero specifies that no logical blocks
    shall be read. This condition shall not be considered an error.

    In case we have nothing to do, just complete the command with good status.

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

    Roland Dreier
     
  • This patch changes transport_generic_map_mem_to_cmd() to reject SCSI data
    overflow and to send exception status with CHECK_CONDITION + TCM_INVALID_CDB_FIELD
    for fabrics that are passing a pre-populated struct scatterlist (eg: tcm_loop
    and iscsi-target) being mapped into se_cmd->t_data_sg and se_cmd->t_data_nents.

    This addresses an OOPs where transport_allocate_data_tasks() would walk
    the incorrect post OVERFLOW cmd->data_length value beyond the end of
    the passed scatterlist.

    Cc: Christoph Hellwig
    Cc: Andy Grover
    Cc: stable@kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • And use a SCF_BIDI flag instead.

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

    Christoph Hellwig
     
  • And use a SCF_FUA flag instead.

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

    Christoph Hellwig
     
  • We never walk ordered_cmd_list in the se_device, so remove all code related
    to supporting it.

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

    Christoph Hellwig
     
  • We already have a perfectly valid se_device pointer in the command, so
    remove the mostly useless duplicates.

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

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

    Roland Dreier
     
  • While testing ib_srpt I noticed that the target system became
    rather unresponsive during intensive I/O. The patch below made
    my target system responsive again during I/O without decreasing
    performance.

    Signed-off-by: Bart Van Assche
    Signed-off-by: Nicholas Bellinger

    Bart Van Assche
     
  • This patch removes legacy usage of PYX_TRANSPORT_* return codes in a number
    of locations and addresses cases where transport_generic_request_failure()
    was returning the incorrect sense upon CHECK_CONDITION status after the
    v3.1 converson to use errno return codes.

    This includes the conversion of transport_generic_request_failure() to
    process cmd->scsi_sense_reason and handle extra TCM_RESERVATION_CONFLICT
    before calling transport_send_check_condition_and_sense() to queue up
    response status. It also drops PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES legacy
    usgae, and returns TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE w/ a response
    for these cases.

    transport_generic_allocate_tasks(), transport_generic_new_cmd(), backend
    SCF_SCSI_DATA_SG_IO_CDB ->do_task(), and emulated ->execute_task() have
    all been updated to set se_cmd->scsi_sense_reason and return errno codes
    universally upon failure. This includes cmd->scsi_sense_reason assignment
    in target_core_alua.c, target_core_pr.c and target_core_cdb.c emulation code.

    Finally it updates fabric modules to remove the legacy usage, and for
    TFO->new_cmd_map() callers forwards return values outside of fabric code.
    iscsi-target has also been updated to remove a handful of special cases
    related to the cleanup and signaling QUEUE_FULL handling w/ ft_write_pending()

    (v2: Drop extra SCF_SCSI_CDB_EXCEPTION check during failure from
    transport_generic_new_cmd, and re-add missing task->task_error_status
    assignment in transport_complete_task)

    Cc: Christoph Hellwig
    Cc: stable@kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

04 Nov, 2011

6 commits

  • Instead of calling into transport_emulate_control_cdb from
    __transport_execute_tasks for some CDBs always set up ->exectute_tasks
    in the command sequence and use it uniformly.

    (nab: Add default passthrough break for SERVICE_ACTION_IN)

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

    Christoph Hellwig
     
  • All ->execute_task instances now need to complete the I/O explicitly,
    which can either happen synchronously or asynchronously.

    Note that a lot of the CDB emulations appear to return success even if
    some lowlevel operations failed. Given that this is an existing issue
    this patch doesn't change that fact.

    (nab: Adding missing switch breaks in PR-IN + PR_OUT)

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

    Christoph Hellwig
     
  • We want to be able to handle all CDBs through it and remove hacks like
    always using the first task in a CDB in target_report_luns.

    Also rename the callback to ->execute_task to better describe its use.

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

    Christoph Hellwig
     
  • Split core_scsi2_emulate_crh into one routine each for the
    PERSISTENT_RESERVE_IN and PERSISTENT_RESERVE_OUT side.

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

    Christoph Hellwig
     
  • Split core_scsi2_emulate_crh into one routine each for the reserve and
    release side. The common code now is in a helper called by both
    routines.

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

    Christoph Hellwig
     
  • This patch adds the initial pieces of generic active I/O shutdown logic.
    This is intended to be a 'opt-in' feature for fabric modules that
    includes the following functions to provide a mechinism for fabric
    modules to track se_cmd via se_session->sess_cmd_list:

    *) target_get_sess_cmd() - Add se_cmd to sess->sess_cmd_list, called
    from fabric module incoming I/O path.
    *) target_put_sess_cmd() - Check for completion or drop se_cmd from
    ->sess_cmd_list
    *) target_splice_sess_cmd_list() - Splice active I/O list from
    ->sess_cmd_list to ->sess_wait_list, can called with HW fabric
    lock held.
    *) target_wait_for_sess_cmds() - Walk ->sess_wait_list waiting on
    individual ->cmd_wait_comp. Optional transport_wait_for_tasks()
    call.

    target_splice_sess_cmd_list() is allowed to be called under HW fabric
    lock, and performs the splice into se_sess->sess_wait_list and set
    se_cmd->cmd_wait_set. Then target_wait_for_sess_cmds() walks the list
    waiting for individual target_put_sess_cmd() fabric callbacks to
    complete.

    It also adds TFO->check_release_cmd() to split the completion and memory
    release calls, where a fabric module uses target_put_sess_cmd() to check
    for I/O completion during session shutdown. This is currently pushed out
    into fabric modules as current fabric code may sleep here waiting for
    TFO->check_stop_free() to complete in main response path, and because
    target_wait_for_sess_cmds() calling TFO->release_cmd() to free fabric
    descriptor memory directly.

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

    Nicholas Bellinger
     

03 Nov, 2011

1 commit

  • The commit

    target: use a workqueue for I/O completions

    accidentally removed setting t_tasks_failed in transport_complete_task.
    Add it back in a slightly cleaner way; now it is set for every failed task
    instead of special casing the last one completing by using the success
    argument directly for it.

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

    Christoph Hellwig
     

02 Nov, 2011

2 commits

  • This patch drops TRANSPORT_FREE_CMD_INTR usage from target core, which
    includes the removal of transport_generic_free_cmd_intr() symbol,
    TRANSPORT_FREE_CMD_INTR usage in transport_processing_thread(), and
    special case LUN_RESET handling to skip TRANSPORT_FREE_CMD_INTR processing
    in core_tmr_drain_cmd_list(). We now expect that fabric modules will
    use an internal workqueue to provide process context when releasing
    se_cmd descriptor resources via transport_generic_free_cmd().

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

    Nicholas Bellinger
     
  • This patch converts target_core_fabric_ops->check_stop_free() usage in
    transport_cmd_check_stop() and associated fabric module usage to
    return '1' when the passed se_cmd has been released directly within
    ->check_stop_free(), or return '0' when the passed se_cmd has not
    been released.

    This addresses an issue where transport_cmd_finish_abort() ->
    transport_cmd_check_stop_to_fabric() was leaking descriptors during
    LUN_RESET for modules using ->check_stop_free(), but not directly
    releasing se_cmd in all cases.

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

    Nicholas Bellinger
     

01 Nov, 2011

1 commit


27 Oct, 2011

1 commit

  • This patch changes target core to also check for -ENOMEM from fabric callbacks
    to signal QUEUE_FULL status, instead of just -EAGAIN in order to catch a
    larger set of fabric failure cases that want to trigger QUEUE_FULL logic.
    This includes the callbacks for ->write_pending(), ->queue_data_in() and
    ->queue_status().

    It also makes transport_generic_write_pending() return zero upon QUEUE_FULL,
    and removes two unnecessary -EAGAIN checks to catch write pending QUEUE_FULL
    cases from transport_generic_new_cmd() failures in transport_handle_cdb_direct()
    and transport_processing_thread():TRANSPORT_NEW_CMD_MAP state.

    Reported-by: Bart Van Assche
    Cc: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: Roland Dreier
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     

24 Oct, 2011

17 commits

  • This patch removes the legacy usage of se_task->task_timer and associated
    infrastructure that originally was used as a way to help manage buggy backend
    SCSI LLDs that in certain cases would never return back an outstanding task.

    This includes the removal of target_complete_timeout_work(), timeout logic
    from transport_complete_task(), transport_task_timeout_handler(),
    transport_start_task_timer(), the per device task_timeout configfs attribute,
    and all task_timeout associated structure members and defines in
    target_core_base.h

    This is being removed in preparation to make transport_complete_task() run
    in lock-less mode.

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

    Nicholas Bellinger
     
  • This patch converts target-core to use se_cmd->t_transport_sent instead of
    a duplicated se_cmd->transport_sent member in a handful of locations.
    It also updates iscsi_target to properly use ->t_transport_sent instead of
    it's own iscsi_cmd_t->transport_sent value that was not being assigned.

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

    Nicholas Bellinger
     
  • If we only have a single task per command (which at least in my testing
    is the by far most common case) we do not have to allocate a new per-task
    S/G list but can reuse the one from the command.

    (nab: Fix BIDI handling in transport_free_dev_tasks)

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

    Christoph Hellwig
     
  • This patch fixes a bug for BIDI handling in transport_generic_new_cmd() where
    cmd->t_task_cdbs_left and Co. where not taking into account the extra
    task count generated during the first call to transport_allocate_data_tasks().

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

    Nicholas Bellinger
     
  • There were only two callers, and one of them always wants the call
    to transport_allocate_data_tasks anyway. Also drop the constant
    lba argument to transport_allocate_data_tasks and move the variables
    inside it into the minimum required scope.

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

    Christoph Hellwig
     
  • These are two fairly small functions, and merging them gives a much
    more readable control flow, and opportunities for more useful comments.

    It also moves all code related to resources allocation closer together
    and allows to remove a forward declaration for transport_allocate_tasks.

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

    Christoph Hellwig
     
  • This field is never used given that BIDI handling happens at the
    command and not the task level. Remove it and the dead code in
    pscsi that tries to work on it.

    It also prevents pSCSI passthrough for the two currently enabled BIDI
    commands now that task->task_sg_bidi support has been removed.

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

    Christoph Hellwig
     
  • Remove the now unnecessary extra call to transport_subsystem_check_init() in
    target_core_register_fabric(), and also merge transport_subsystem_reqmods()
    directly into transport_subsystem_check_init().

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

    Nicholas Bellinger
     
  • Instead of abusing the target processing thread for offloading I/O
    completion in the backends to user context add a new workqueue. This means
    completions can be processed as fast as available CPU time allows it,
    including in parallel with other completions and more importantly I/O
    submission or QUEUE FULL retries. This should give much better performance
    especially on loaded systems.

    As a fallout we can merge all the completed states into a single
    one.

    On the downside this change complicates lun reset handling a bit by
    requiring us to cancel a work item only for those states that have it
    initialized. The alternative would be to either always initialize the work
    item to a dummy handler, or always use the same handler and do a switch on
    the state. The long term solution will be a flag that says that the command
    has an initialized work item, but that's only going to be useful once we
    have more users.

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

    Christoph Hellwig
     
  • We never check for this state, and it makes testing for a completed
    state much harder given that it overrides the existing state.

    Also remove the unused deferred_t_state which is related to it.

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

    Christoph Hellwig
     
  • We never queue an command with this state, and only set it in a completely
    bogus place in tcm_fc.

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

    Christoph Hellwig
     
  • We only need to decrement dev->depth_left if failing a command from
    __transport_execute_tasks. Instead of doing it first thing in
    transport_generic_request_failure and requiring a pseudo-flag argument
    for it just opencode the decrement in the two callers (which should
    be factored into a single one anyway)

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

    Christoph Hellwig
     
  • Currently we stop the timers for all tasks in a command fairly late during
    I/O completion, which is fairly pointless and requires all kinds of safety
    checks.

    Instead delete pending timers early on in transport_complete_task, thus
    ensuring no new timers firest after that. We take t_state_lock a bit later
    in that function thus making sure currenly running timers are out of the
    criticial section. To be completely sure the timer has finished we also
    add another del_timer_sync call when freeing the task.

    This also allows removing TF_TIMER_RUNNING as it would be equivalent
    to TF_ACTIVE now.

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

    Christoph Hellwig
     
  • TF_TIMER_STOP is useless as it only helps to mitigate a tiny race during
    deleting the timer. But given that we have cleared TF_ACTIVE at this point
    we already have another mitigation a few lines down the function.

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

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

    Christoph Hellwig
     
  • list_for_each_entry_safe only protects against deletions from the list,
    but not against any concurrent modifications. Given that we drop
    t_state_lock inside the loop it is not safe in transport_free_dev_tasks.

    Instead of use a local dispose_list that we move all tasks that are
    to be deleted to. This is safe because we never do list_emptry checks
    on t_list to check if a command is on the list anywhere.

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

    Christoph Hellwig
     
  • Change one remaining user of transport_cmd_check_stop(cmd, 2, 0) to the
    transport_cmd_check_stop_to_fabric wrapper.

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

    Christoph Hellwig