06 Dec, 2011

9 commits


07 Nov, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
    target: use ->exectute_task for all CDB emulation
    target: remove SCF_EMULATE_CDB_ASYNC
    target: refactor transport_emulate_control_cdb
    target: pass the se_task to the CDB emulation callback
    target: split core_scsi3_emulate_pr
    target: split core_scsi2_emulate_crh
    target: Add generic active I/O shutdown logic
    target: add back error handling in transport_complete_task
    target/pscsi: blk_make_request() returns an ERR_PTR()
    target: Remove core TRANSPORT_FREE_CMD_INTR usage
    target: Make TFO->check_stop_free return free status
    iscsi-target: Fix non-immediate TMR handling
    iscsi-target: Add missing CMDSN_LOWER_THAN_EXP check in iscsit_handle_scsi_cmd
    target: Avoid double list_del for aborted se_tmr_req
    target: Minor cleanups to core_tmr_drain_tmr_list
    target: Fix wrong se_tmr being added to drain_tmr_list
    target: Fix incorrect se_cmd assignment in core_tmr_drain_tmr_list
    target: Check -ENOMEM to signal QUEUE_FULL from fabric callbacks
    tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB
    target: Fix compile warning w/ missing module.h include

    Linus Torvalds
     

04 Nov, 2011

3 commits

  • 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
     
  • 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
     

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
     

25 Oct, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (59 commits)
    MAINTAINERS: linux-m32r is moderated for non-subscribers
    linux@lists.openrisc.net is moderated for non-subscribers
    Drop default from "DM365 codec select" choice
    parisc: Kconfig: cleanup Kernel page size default
    Kconfig: remove redundant CONFIG_ prefix on two symbols
    cris: remove arch/cris/arch-v32/lib/nand_init.S
    microblaze: add missing CONFIG_ prefixes
    h8300: drop puzzling Kconfig dependencies
    MAINTAINERS: microblaze-uclinux@itee.uq.edu.au is moderated for non-subscribers
    tty: drop superfluous dependency in Kconfig
    ARM: mxc: fix Kconfig typo 'i.MX51'
    Fix file references in Kconfig files
    aic7xxx: fix Kconfig references to READMEs
    Fix file references in drivers/ide/
    thinkpad_acpi: Fix printk typo 'bluestooth'
    bcmring: drop commented out line in Kconfig
    btmrvl_sdio: fix typo 'btmrvl_sdio_sd6888'
    doc: raw1394: Trivial typo fix
    CIFS: Don't free volume_info->UNC until we are entirely done with it.
    treewide: Correct spelling of successfully in comments
    ...

    Linus Torvalds
     

24 Oct, 2011

24 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
     
  • 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
     
  • 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
     
  • 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
     
  • Add a new boolean at_head parameter to transport_add_cmd_to_queue and thus
    obsolete the SCF_EMULATE_QUEUE_FULL flag.

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

    Christoph Hellwig
     
  • Remove the need for the transport_qf_callback callback by making
    sure we have specific states with specific handlers for the two
    queue full cases.

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

    Christoph Hellwig
     
  • Remove the dpo_emulated, fua_write_emulated, fua_read_emulated and
    write_cache_emulated methods, and replace them with a simple bitfields in
    se_subsystem_api in those cases where they ever returned one.

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

    Christoph Hellwig
     
  • Add a switch statement implementing the CDB LBA/len update directly
    in target_get_task_cdb and remove the old ->transport_split_cdb
    callback and all its implementations.

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

    Christoph Hellwig
     
  • Instead of calling out to the backends from the core to get a per-task
    CDB and then modify it for the LBA/len pair used for this CDB provide
    a helper that writes the adjusted CDB into a provided buffer and call
    this method from ->do_task in pscsi.

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

    Christoph Hellwig
     
  • Rearrange the fields in se_task to avoid holes. Also increase the
    flags field to 16 bits as we have the space for it, and this makes
    adding new flags safer.

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

    Christoph Hellwig
     
  • This is a squashed version of the following unnecessary se_task structure
    member removal patches:

    target: remove the task_execute_queue field in se_task

    Instead of using a separate flag we can simply do list_emptry checks
    on t_execute_list if we make sure to always use list_del_init to remove
    a task from the list. Also factor some duplicate code into a new
    __transport_remove_task_from_execute_queue helper.

    target: remove the read-only task_no field in se_task

    The task_no field never was initialized and only used in debug printks,
    so kill it.

    target: remove the task_padded_sg field in se_task

    This field is only check in one place and not actually needed there.

    Rationale:
    - transport_do_task_sg_chain asserts that we have task_sg_chaining
    set early on
    - we only make use of the sg_prev_nents field we calculate based on it
    if there is another sg list that gets chained onto this one, which
    never happens for the last (or only) task.

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

    Christoph Hellwig
     
  • Replace various atomic_t variables that were mostly under t_state_lock
    with new flags in task_flags. Note that the execution error path
    didn't take t_state_lock before, so add it there.

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

    Christoph Hellwig
     
  • This is a squashed version of the following se_task cleanup patches:

    target: remove the unused task_state_flags field in se_task
    target: remove the unused se_obj_ptr field in se_task
    target: remove the se_dev field in se_task

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

    Christoph Hellwig
     
  • This is a squashed version of the following target_core_base.h
    cleanup patches:

    target: remove the unused SHUTDOWN_SIGS defintion
    target: remove unused se_mem leftovers
    target: remove the unused map_func_t typedef
    target: move TRANSPORT_IOV_DATA_BUFFER to the iscsi-specific code

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

    Christoph Hellwig
     
  • This patch merges transport_cmd_finish_abort_tmr() logic into a single
    transport_cmd_finish_abort() function by adding a cmd->se_tmr_req check
    around transport_lun_remove_cmd(), and updates the single caller within
    core_tmr_drain_tmr_list().

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

    Nicholas Bellinger
     
  • This patch converts se_cmd->transport_wait_for_tasks(se_cmd, 1) usage to use
    transport_generic_free_cmd() directly in target-core and iscsi-target fabric
    usage. The includes:

    *) Removal of the optional transport_generic_free_cmd() call from within
    transport_generic_wait_for_tasks()
    *) Usage of existing SCF_SUPPORTED_SAM_OPCODE to determine when
    transport_generic_wait_for_tasks() processing may occur instead of
    checking se_cmd->transport_wait_for_tasks()
    *) Move transport_generic_wait_for_tasks() call ahead of core_dec_lacl_count()
    and transport_lun_remove_cmd() in transport_generic_free_cmd() to follow
    existing logic for iscsi-target w/ se_cmd->transport_wait_for_tasks(se_cmd, 1)
    *) Removal of se_cmd->transport_wait_for_tasks() function pointer
    *) Rename transport_generic_wait_for_tasks() -> transport_wait_for_tasks(), and
    add docbook comment.
    *) Add EXPORT_SYMBOL for transport_wait_for_tasks()

    For the case in iscsi_target_erl2.c:iscsit_prepare_cmds_for_realligance()
    where se_cmd->transport_wait_for_tasks(se_cmd, 0) is called, this patch
    adds a direct call to transport_wait_for_tasks().

    (hch: Fix transport_generic_free_cmd() usage in iscsit_release_commands_from_conn)
    (nab: Add patch: Ensure that TMRs hit wait_for_tasks logic during release)

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

    Nicholas Bellinger
     
  • Testing in_interrupt() to know when sleeping is allowed is not really
    reliable (since eg it won't be true if the caller is holding a spinlock).
    Instead have the caller tell core_tmr_alloc_req() what GFP_xxx to use;
    every caller except tcm_qla2xxx can use GFP_KERNEL.

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

    Roland Dreier