17 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

1 commit

  • 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
     

15 Jul, 2012

1 commit

  • This patch fixes a crash seen when large reads have their exchange
    aborted by either timing out or being reset. Because the exchange
    abort results in the seq pointer being set to NULL, because the
    sequence is no longer valid, it must not be dereferenced. This
    patch changes the function ft_get_task_tag to return ~0 if it is
    unable to get the tag for this reason. Because the get_task_tag
    interface provides no means of returning an error, this seems
    like the best way to fix this issue at the moment.

    Signed-off-by: Mark Rustad
    Cc:
    Signed-off-by: Nicholas Bellinger

    Mark Rustad
     

15 Apr, 2012

1 commit

  • With the modern target core, se_cmd->t_data_sg already points to a
    sglist that covers the whole command. So task_sg chaining is needless
    overhead and obfuscation -- instead of splicing the split up task
    sglists back into one list, we can just use the original list directly.

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

    Roland Dreier
     

07 Apr, 2012

1 commit

  • Add abort flag and use it to terminate processing when an exchange
    is timed out or is reset. The abort flag is used in place of the
    transport_generic_free_cmd function call in the reset and timeout
    cases, because calling that function in that context would free
    memory that was in use. The aborted flag allows the lifetime to
    be managed in a more normal way, while truncating the processing.

    This change eliminates a source of memory corruption which
    manifested in a variety of ugly ways.

    (nab: Drop unused struct fc_exch *ep in ft_recv_seq)

    Signed-off-by: Mark Rustad
    Acked-by: Kiran Patil
    Cc:
    Signed-off-by: Nicholas Bellinger

    Mark Rustad
     

11 Mar, 2012

2 commits

  • This patch fixes a bug in tcm_fc where fc_exch memory from fc_exch_mgr->ep_pool
    is currently being leaked by ft_send_resp_status() usage. Following current
    code in ft_queue_status() response path, using lport->tt.seq_send() needs to be
    followed by a lport->tt.exch_done() in order to release fc_exch memory back into
    libfc_em kmem_cache.

    ft_send_resp_status() code is currently used in pre submit se_cmd ft_send_work()
    error exceptions, TM request setup exceptions, and main TM response callback
    path in ft_queue_tm_resp(). This bugfix addresses the leak in these cases.

    Cc: Mark D Rustad
    Cc: Kiran Patil
    Cc: Robert Love
    Cc: Andy Grover
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

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

26 Feb, 2012

10 commits


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

2 commits

  • This patch converts the main ft_send_work() I/O path to use
    target_submit_cmd() with a single se_cmd->cmd_kref reference
    that is released via the existing ft_check_stop_free() response
    path callback.

    It also makes ft_send_tm() use transport_init_se_cmd() and
    target_get_sess_cmd() to also use single se_cmd->cmd_kref
    reference.

    Cc: Christoph Hellwig
    Cc: Kiran Patil
    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
     

06 Dec, 2011

1 commit

  • 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
     

02 Nov, 2011

1 commit

  • 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
     

24 Oct, 2011

4 commits


11 Oct, 2011

1 commit


16 Sep, 2011

1 commit

  • Problem: Changed from wake_up_interruptible -> wake_up_process and
    wait_event_interruptible-> schedule_timeout_interruptible broke the FCoE
    target. Earlier approach of wake_up_interruptible was also looking at
    'queue_cnt' which is not necessary, because it increment of 'queue_cnt'
    with wake_up_inetrriptible / waker_up_process introduces race condition.

    Fix: Instead of fixing the code which used wake_up_process and remove
    'queue_cnt', using work_queue based approach is cleaner and acheives
    same result. As well, work queue based approach has less programming
    overhead and OS manages threads which processes work queues.

    This patch is developed by Christoph Hellwig and reviwed+validated by
    Kiran Patil.

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

    Christoph Hellwig
     

04 Aug, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
    tcm_fc: Handle DDP/SW fc_frame_payload_get failures in ft_recv_write_data
    target: Fix bug for transport_generic_wait_for_tasks with direct operation
    target: iscsi_target depends on NET
    target: Fix WRITE_SAME_16 lba assignment breakage
    MAINTAINERS: Add target-devel list for drivers/target/
    iscsi-target: Fix CONFIG_SMP=n and CONFIG_MODULES=n build failure
    iscsi-target: Fix snprintf usage with MAX_PORTAL_LEN
    iscsi-target: Fix uninitialized usage of cmd->pad_bytes
    iscsi-target: strlen() doesn't count the terminator
    iscsi-target: Fix NULL dereference on allocation failure

    Linus Torvalds
     

03 Aug, 2011

1 commit

  • Problem: HW DDP context was not invalidated in case of ABORTS, etc...
    This leads to the problem where memory pages which are used for DDP
    as user descriptor could get reused for some other purpose (such as to
    satisfy new memory allocation request either by kernel or user mode threads)
    and since HW DDP context was not invalidated, HW continue to write to
    those pages, hence causing memory corruption.

    Fix: Either on incoming ABORTS or due to exchange time out, allowed the
    target to cleanup HW DDP context if it was setup for respective ft_cmd.
    Added new function to perform this cleanup, furthur it can be enhanced
    for other cleanup activity. Fix ft_recv_write_data() to properly handle
    fc_frame_payload_get to return pointer to payload if it exist. If there is
    no payload which is most common case (+ve case in case if DDP is working
    as expected, it will return NULL. Yes, scope of buf is limited to printk.
    Invalidation of HW context (which is done inside ft_invl_hw_context() is
    necessary in SUCCESS and FAILURE case of DDP. Hence invalidation is DONE
    as long as there was DDP setup (whether it worked correctly or not,

    NOTE: For some reason, if there is any error w.r.t DDP such as out of
    order packet reception, HW simply post the full packet in rx queue.

    Signed-off-by: Kiran Patil
    Cc: Robert W Love
    Signed-off-by: Nicholas A. Bellinger

    Kiran Patil
     

26 Jul, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    fs: Merge split strings
    treewide: fix potentially dangerous trailing ';' in #defined values/expressions
    uwb: Fix misspelling of neighbourhood in comment
    net, netfilter: Remove redundant goto in ebt_ulog_packet
    trivial: don't touch files that are removed in the staging tree
    lib/vsprintf: replace link to Draft by final RFC number
    doc: Kconfig: `to be' -> `be'
    doc: Kconfig: Typo: square -> squared
    doc: Konfig: Documentation/power/{pm => apm-acpi}.txt
    drivers/net: static should be at beginning of declaration
    drivers/media: static should be at beginning of declaration
    drivers/i2c: static should be at beginning of declaration
    XTENSA: static should be at beginning of declaration
    SH: static should be at beginning of declaration
    MIPS: static should be at beginning of declaration
    ARM: static should be at beginning of declaration
    rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check
    Update my e-mail address
    PCIe ASPM: forcedly -> forcibly
    gma500: push through device driver tree
    ...

    Fix up trivial conflicts:
    - arch/arm/mach-ep93xx/dma-m2p.c (deleted)
    - drivers/gpio/gpio-ep93xx.c (renamed and context nearby)
    - drivers/net/r8169.c (just context changes)

    Linus Torvalds
     

24 Jul, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (77 commits)
    [SCSI] fix crash in scsi_dispatch_cmd()
    [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise
    [SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu
    [SCSI] bfa: Update the driver version to 3.0.2.1
    [SCSI] bfa: Driver and BSG enhancements.
    [SCSI] bfa: Added support to query PHY.
    [SCSI] bfa: Added HBA diagnostics support.
    [SCSI] bfa: Added support for flash configuration
    [SCSI] bfa: Added support to obtain SFP info.
    [SCSI] bfa: Added support for CEE info and stats query.
    [SCSI] bfa: Extend BSG interface.
    [SCSI] bfa: FCS bug fixes.
    [SCSI] bfa: DMA memory allocation enhancement.
    [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
    [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes.
    [SCSI] bfa: Added Fabric Assigned Address(FAA) support
    [SCSI] bfa: IOC bug fixes.
    [SCSI] bfa: Enable ASIC block configuration and query.
    [SCSI] bnx2i: Updated copyright and bump version
    [SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported
    ...

    Fix up some trivial conflicts in:
    - drivers/scsi/bnx2fc/{bnx2fc.h,bnx2fc_fcoe.c}:
    Crazy broadcom version number conflicts
    - drivers/target/tcm_fc/tfc_cmd.c
    Just trivial cleanups done on adjacent lines

    Linus Torvalds
     

22 Jul, 2011

7 commits

  • This patch contains the squashed version of forth round series cleanups
    from Andy and Christoph following the post heavy lifting in the preceeding:
    'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
    changes. This also includes a conversion of target core and the v3.0
    mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
    CONFIG_DYNAMIC_DEBUG infrastructure!

    These have been squashed into this third and final round for v3.1.

    target: Remove ifdeffed code in t_g_process_write
    target: Remove direct ramdisk code
    target: Rename task_sg_num to task_sg_nents
    target: Remove custom debug macros for pr_debug. Use pr_err().
    target: Remove custom debug macros in mainline fabrics
    target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
    target: Remove transport do_se_mem_map callback
    target: Further simplify transport_free_pages
    target: Redo task allocation return value handling
    target: Remove extra parentheses
    target: change alloc_task call to take *cdb, not *cmd

    (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Both backstores and fabrics use arrays of struct scatterlist to describe
    data buffers. However TCM used struct se_mems, basically a linked list
    of scatterlist entries. We are able to simplify the code by eliminating
    this intermediate data structure and just using struct scatterlist[]
    throughout.

    Also, moved attachment of task to cmd out of transport_generic_get_task
    and into allocate_control_task and allocate_data_tasks. The reasoning
    is that it's nonintuitive that get_task should automatically add it to
    the cmd's task list -- it should just return an allocated, initialized
    task. That's all it should do, based on the function's name, so either the
    function shouldn't do it, or the name should change to encapsulate the
    entire essence of what it does.

    (nab: Fix compile warnings in tcm_fc, and make transport_kmap_first_data_page
    honor sg->offset for SGLs from contigious memory with TCM_Loop, and
    fix control se_cmd descriptor memory leak)

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

    Andy Grover
     
  • Previously, some control CDBs did not allocate memory in pages for their
    data buffer, but just did a kmalloc. This patch makes all cdbs allocate
    pages.

    This has the benefit of streamlining some paths that had to behave
    differently when we used two allocation methods. The downside is that
    all accesses to the data buffer need to kmap it before use, and need to
    handle data in page-sized chunks if more than a page is needed for a given
    command's data buffer.

    Finally, note that cdbs with no data buffers are handled a little
    differently. Before, SCSI_NON_DATA_CDBs would not call get_mem at all
    (they'd be in the final else in transport_allocate_resources) but now
    these will make it into generic_get_mem, but just not allocate any
    buffers.

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

    Andy Grover
     
  • This patch converts ft_queue_cmd() to use wake_up_process() and
    ft_thread() to use schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT)
    instead of wait_event_interruptible(). This fixes a potential race with
    the wait_event_interruptible() conditional with qobj->queue_cnt in
    ft_thread().

    This patch also drops the unnecessary set_user_nice(current, -20) in
    ft_thread(), and drops extra () around two if (!(acl)) conditionals in
    tfc_conf.c.

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

    Nicholas Bellinger
     
  • The release_cmd_to_pool and release_cmd_direct methods are always the same.
    Merge them into a single release_cmd method, and clean up the fallout.

    (nab: fix breakage in transport_generic_free_cmd() parameter build breakage
    in drivers/target/tcm_fc/tfc_cmd.c)

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

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

    Christoph Hellwig
     
  • This patch contains a squashed version of third round series cleanups,
    improvements ,and simplfications from Andy and Christoph ahead of the
    heavy lifting between round 3 -> 4 for the target core SGL conversion.

    This include cleanups to the main target I/O path and other miscellaneous
    updates.

    target: Replace custom sgbuf functions with lib funcs
    target: Simplify sector limiting code
    target: get_cdb should never return NULL
    target: Simplify transport_memcpy_se_mem_read_contig
    target: Use assignment rather than increment for t_task_cdbs
    target: Don't pass dma_size to generic_get_mem
    target: Pass sg with type scatterlist in transport_map_sg_to_mem
    target: Move task_sg_num next to task_sg in struct se_task
    target: inline struct se_transport_task into struct se_cmd
    target: Change name & semantics of transport_get_sectors()
    target: Remove unused members of se_cmd
    target: Rename se_cmd.t_task_cdbs to t_task_list_num
    target: Fix some spelling
    target: Remove unused var from transport_generic_do_tmr
    target: map_sg_to_mem: return sg_count in return value
    target/pscsi: Use min_t for sector limits
    target/pscsi: Unused param for pscsi_get_bio()
    target: Rename get_cdb_count to allocate_tasks
    target: Make transport_generic_new_cmd() available for iscsi-target
    target: Remove fabric callback to allocate iovecs
    target: Fix transport_generic_new_cmd WRITE comment

    (hch: Use __GFP_ZERO usage for alloc_pages() usage)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover