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
     

30 Jul, 2011

1 commit

  • This patch fixes a bug in transport_handle_cdb_direct() usage with target_core
    where transport_generic_wait_for_tasks() was bypassing active I/O + usage of
    cmd->t_transport_stop_comp because cmd->t_transport_active=1 was not being set
    before dispatching with transport_generic_new_cmd(). The fix follows existing
    usage in transport_generic_handle_cdb*() -> transport_add_cmd_to_queue() and
    set these directly, as well as handle transport_generic_new_cmd() exceptions
    for QUEUE_FULL and CHECK_CONDITION instead of propigating up to RX context
    fabric code.

    The bug was manifesting itself with the following SLUB poison overwritten
    warnings with iscsi-target v4.1 LUNs using the new process context direct
    operation during session reinstatement with active I/O exception handling:

    [885410.498267] =============================================================================
    [885410.621622] BUG lio_cmd_cache: Poison overwritten
    [885410.621791] -----------------------------------------------------------------------------
    [885410.621792]
    [885410.623420] INFO: 0xffff880000cf3750-0xffff880000cf378d. First byte 0x6a instead of 0x6b
    [885410.626332] INFO: Allocated in iscsit_allocate_cmd+0x1c/0xd4 [iscsi_target_mod] age=345 cpu=1 pid=22554
    [885411.855189] INFO: Freed in iscsit_release_cmd+0x208/0x217 [iscsi_target_mod] age=1410 cpu=1 pid=22554
    [885411.856048] INFO: Slab 0xffffea000002d480 objects=22 used=0 fp=0xffff880000cf7300 flags=0x4080
    [885411.856368] INFO: Object 0xffff880000cf33c0 @offset=13248 fp=0xffff880000cf6780

    [885411.955678] Pid: 22554, comm: iscsi_trx Not tainted 3.0.0-rc7+ #30
    [885411.956040] Call Trace:
    [885411.957029] [] print_trailer+0x12e/0x137
    [885412.752879] [] check_bytes_and_report+0xb9/0xfd
    [885412.754933] [] check_object+0xb5/0x192
    [885412.755099] [] __free_slab+0x96/0x13a
    [885412.757008] [] discard_slab+0x41/0x43
    [885412.758171] [] __slab_free+0xf3/0xfe
    [885412.761027] [] ? iscsit_release_cmd+0x208/0x217 [iscsi_target_mod]
    [885412.761354] [] kmem_cache_free+0x6f/0xac
    [885412.761536] [] iscsit_release_cmd+0x208/0x217 [iscsi_target_mod]
    [885412.762056] [] ? iblock_free_task+0x34/0x39 [target_core_iblock]
    [885412.762368] [] lio_release_cmd+0x10/0x12 [iscsi_target_mod]
    [885412.764129] [] transport_release_cmd+0x2f/0x33 [target_core_mod]
    [885412.805024] [] transport_generic_remove+0xb6/0xc3 [target_core_mod]
    [885412.806424] [] ? try_to_wake_up+0x1bd/0x1bd
    [885412.809033] [] transport_generic_free_cmd+0x75/0x7d [target_core_mod]
    [885412.810066] [] transport_generic_wait_for_tasks+0x21c/0x22b [target_core_mod]
    [885412.811056] [] ? mutex_lock+0x11/0x32
    [885412.813059] [] ? mutex_lock+0x11/0x32
    [885412.813200] [] iscsit_close_connection+0x1d5/0x63a [iscsi_target_mod]
    [885412.813517] [] iscsit_take_action_for_connection_exit+0xdb/0xe0 [iscsi_target_mod]
    [885412.813851] [] iscsi_target_rx_thread+0x11f6/0x1221 [iscsi_target_mod]
    [885412.829024] [] ? pick_next_task_fair+0xbe/0x10e
    [885412.831010] [] ? iscsit_handle_scsi_cmd+0x91d/0x91d [iscsi_target_mod]
    [885412.833011] [] ? iscsit_handle_scsi_cmd+0x91d/0x91d [iscsi_target_mod]
    [885412.835010] [] kthread+0x7d/0x85
    [885412.837022] [] kernel_thread_helper+0x4/0x10
    [885412.838008] [] ? kthread_worker_fn+0x145/0x145
    [885412.840047] [] ? gs_change+0x13/0x13
    [885412.842007] FIX lio_cmd_cache: Restoring 0xffff880000cf3750-0xffff880000cf378d=0x6

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

    Nicholas Bellinger
     

29 Jul, 2011

1 commit

  • iscsi target code uses lots on network interface functions, so it
    should depend on NET. Fixes many build errors when NET is not enabled:

    ERROR: "kernel_sendmsg" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "in_aton" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "sock_release" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "kernel_listen" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "kernel_setsockopt" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "kernel_recvmsg" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "kernel_accept" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "sock_create" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "kernel_bind" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
    ERROR: "in6_pton" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!

    Signed-off-by: Randy Dunlap
    Signed-off-by: Nicholas Bellinger

    Randy Dunlap
     

28 Jul, 2011

7 commits

  • This patch fixes a bug in WRITE_SAME_16 LBA assignment where get_unaligned_be16()
    is incorrectly being used instead of get_unaligned_be64() for a 64-bit LBA.

    This was introduced with:

    commit a1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6
    Author: Andy Grover
    Date: Mon May 2 17:12:10 2011 -0700

    target: Updates from AGrover and HCH (round 3)

    (target: inline struct se_transport_task into struct se_cmd)

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes the following CONFIG_SMP=n and CONFIG_MODULES=n build
    failure, because iscsit_thread_get_cpumask() is defined as a macro in
    iscsi_target.c, but needed by iscsi_target_login.c

    drivers/built-in.o: In function `iscsi_post_login_handler':
    iscsi_target_login.c:(.text+0x13a315): undefined reference to `iscsit_thread_get_cpumask'
    iscsi_target_login.c:(.text+0x13a4b4): undefined reference to `iscsit_thread_get_cpumask'
    make: *** [.tmp_vmlinux1] Error 1

    Reported-by: Randy Dunlap
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch makes lio_target_call_addnptotpg() use sprintf() with
    MAX_PORTAL_LEN + 1 to address the following smatch warning:

    drivers/target/iscsi/iscsi_target_configfs.c +184 lio_target_call_addnptotpg(21)
    error: snprintf() chops off the last chars of 'name': 257 vs 256

    Reported-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes an uninitialized usage of cmd->pad_bytes inside of
    iscsit_handle_text_cmd() introduced during a v4.1 change to use cmd
    members instead of local pad_bytes variables.

    Reported-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes an off by one check in iscsit_add_tiqn() because the
    NULL terminator isn't taken into consideration.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Dan Carpenter
     
  • This patch fixes a bug in iscsi_target_init_negotiation() where
    the "goto out" path dereferences "login" which is NULL upon a
    memory allocation failure.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Dan Carpenter
     
  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
    target: Convert to DIV_ROUND_UP_SECTOR_T usage for sectors / dev_max_sectors
    kernel.h: Add DIV_ROUND_UP_ULL and DIV_ROUND_UP_SECTOR_T macro usage
    iscsi-target: Add iSCSI fabric support for target v4.1
    iscsi: Add Serial Number Arithmetic LT and GT into iscsi_proto.h
    iscsi: Use struct scsi_lun in iscsi structs instead of u8[8]
    iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi

    Linus Torvalds
     

26 Jul, 2011

3 commits

  • This patch adds the new macro usage of include/linux/kernel.h:DIV_ROUND_UP_SECTOR_T
    for the new DIV_ROUND_UP_ULL() usage for 32-bit architectures with unsigned long long
    sector_t division in transport_allocate_data_tasks() usage for target_core_mod v4.1

    Reported-by: Andrew Morton
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • The Linux-iSCSI.org target module is a full featured in-kernel
    software implementation of iSCSI target mode (RFC-3720) for the
    current WIP mainline target v4.1 infrastructure code for the v3.1
    kernel. More information can be found here:

    http://linux-iscsi.org/wiki/ISCSI

    This includes support for:

    * RFC-3720 defined request / response state machines and support for
    all defined iSCSI operation codes from Section 10.2.1.2 using libiscsi
    include/scsi/iscsi_proto.h PDU definitions
    * Target v4.1 compatible control plane using the generic layout in
    target_core_fabric_configfs.c and fabric dependent attributes
    within /sys/kernel/config/target/iscsi/ subdirectories.
    * Target v4.1 compatible iSCSI statistics based on RFC-4544 (iSCSI MIBS)
    * Support for IPv6 and IPv4 network portals in M:N mapping to TPGs
    * iSCSI Error Recovery Hierarchy support
    * Per iSCSI connection RX/TX thread pair scheduling affinity
    * crc32c + crc32c_intel SSEv4 instruction offload support using libcrypto
    * CHAP Authentication support using libcrypto
    * Conversion to use internal SGl allocation with iscsit_alloc_buffs() ->
    transport_generic_map_mem_to_cmd()

    (nab: Fix iscsi_proto.h struct scsi_lun usage from linux-next in commit:
    iscsi: Use struct scsi_lun in iscsi structs instead of u8[8])
    (nab: Fix 32-bit compile warnings)

    Reviewed-by: Christoph Hellwig
    Reviewed-by: Andy Grover
    Acked-by: Roland Dreier
    Signed-off-by: Nicholas A. Bellinger

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

25 commits

  • This patch drops transport_asciihex_to_binaryhex() in favor of proper
    hex2bin usage from include/linux/kernel.h:hex2bin()

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

    Andy Shevchenko
     
  • Additionally this patch brings proper apply of the designator type.
    However, the original code luckily has no bug, because the association
    equals to 0.

    Signed-off-by: Andy Shevchenko
    Cc: James Bottomley
    Signed-off-by: Nicholas Bellinger

    Andy Shevchenko
     
  • This patch adds the default 'Unrestricted reordering allowed' for SCSI
    control mode page QUEUE ALGORITHM MODIFIER on a per se_device basis in
    target_modesense_control() following spc4r23. This includes a new
    emuluate_rest_reord configfs attribute that currently (only) accepts
    zero to signal 'Unrestricted reordering allowed' in control mode page
    usage by the backend target device.

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

    Nicholas Bellinger
     
  • This patch breaks up the ->map_task_SG() backend call into two seperate
    ->map_control_SG() and ->map_data_SG() in order to better address
    IBLOCK and pSCSI. IBLOCK only allocates bios for ->map_data_SG(), and
    pSCSI will allocate a struct request for both cases.

    This patch fixes incorrect usage of ->map_task_SG() for all se_cmd descriptors
    in transport_generic_new_cmd() by moving the call into it's proper location
    directly inside of transport_allocate_data_tasks()

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

    Nicholas Bellinger
     
  • 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
     
  • Since sectors is not modified, it's more straightforward to do this.

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

    Andy Grover
     
  • Due to all cdbs' data buffers being referenced by scatterlists, buffers
    of more than a page are not contiguous. Instead of handling this in all
    control command handlers, we may be able to get away with just limiting
    control cdb data buffers to one page. The only control CDBs we handle that
    have potentially large data buffers are REPORT LUNS and UNMAP, so if we
    didn't want to live with this limitation, they would need to be modified
    to walk the pages in the data buffer's sgl.

    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
     
  • Implement page B1h, Block Device Characteristics, so that we can report
    a medium rotation rate of 1 (non-rotating / solid state) if the
    is_nonrot device attribute is set; we update the iblock backend to set
    this attribute if the underlying Linux block device has its nonrot
    flag set.

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

    Roland Dreier
     
  • The current handling of VPD page 00h (Supported VPD Pages) for INQUIRY
    commands has a couple of problems:

    - The page length field is incorrectly set to 3, so the entry for 86h
    (Extended INQUIRY Data) is ignored since it is in the fourth slot.
    - Even though the code handles pages B0h and B2h, those pages aren't
    mentioned in the Supported VPD Pages list, so eg the Linux SCSI stack
    won't actually try to use them.

    Fix these problems and make things more robust to avoid future problems
    by moving to a table of supported VPD pages, which means that any added
    VPD page support will automatically get reported on page 0.

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

    Roland Dreier
     
  • In target_fabric_configfs_init(), we should allow fabric_mod to be NULL,
    since THIS_MODULE is NULL for built-in modules. The main method of
    using the target code may be as modules, but having everything built-in
    is useful eg to be able to do quick testing with "qemu -kernel".

    In any case, we shouldn't bomb out fabric registration for a perfectly
    valid configuration, so simply drop the check of fabric_mod.

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

    Roland Dreier
     
  • 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
     
  • This patch removes the unnecessary EXTRA_CFLAGS includes, and drops the
    unused -DTCM_FC_DEBUG define.

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

    Nicholas Bellinger
     
  • There is a memory leak in tcm_loop_make_scsi_hba().

    If all the strstr() calls return NULL and we end up at return ERR_PTR(-EINVAL);
    then we'll be leaking the memory previously allocated to tl_hba as
    that variable goes out of scope.

    This patch should fix the leak.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas Bellinger

    Jesper Juhl
     
  • Signed-off-by: Jesper Juhl
    Signed-off-by: Nicholas Bellinger

    Jesper Juhl
     
  • This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result
    in memory corruption.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas A. Bellinger

    Dan Carpenter
     
  • ibd_depth and ibd_force are used write-only. Remove them.
    ibd_major/minor can be easily retrieved from ibd_bd, so get
    rid of them too.

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

    Roland Dreier
     
  • This patch converts iblock_create_virtdevice() to use request_queue->nr_request
    for se_dev_limits usage of ->hw_queue_depth and ->queue_depth for individual
    struct se_device export.

    It also removes the now unused defines for IBLOCK_DEVICE_QUEUE_DEPTH and
    IBLOCK_MAX_DEVICE_QUEUE_DEPTH

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • transport_lookup_tmr_lun() can be called from interrupt context and
    therefore needs to use IRQ-safe spinlock functions. Fix this up, and
    to make the locking work, convert the other uses of se_tmr_lock to be
    IRQ-disabling.

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

    Roland Dreier
     
  • se_dev_check_online() is called from transport_lookup_cmd_lun(), which
    as discussed before may be called from interrupt context. So it needs
    to use spin_lock_irqsave() instead of spin_lock_irq() to avoid
    enabling interrupts at the wrong time.

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

    Roland Dreier
     
  • transport_lookup_cmd_lun() may be called from interrupt context (eg
    tcm_loop_allocate_core_cmd() calls it, and it has a comment that says,
    "Can be called from interrupt context"), so it needs to use
    spin_lock_irqsave() instead of spin_lock_irq() to avoid enabling
    interrupts at the wrong time.

    (And indeed the last set of lock operations, on lun_cmd_lock, were
    already using spin_lock_irqsave(), so we just need to fix the other
    two locks we take)

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

    Roland Dreier
     
  • This patch adds SCF_EMULATE_QUEUE_FULL support using -EAGAIN failures
    via transport_handle_queue_full() to signal queue full in completion
    path TFO->queue_data_in() and TFO->queue_status() callbacks.

    This is done using a new se_cmd->transport_qf_callback() to handle
    the following queue full exception cases within target core:

    *) TRANSPORT_COMPLETE_OK (for completion path queue full)

    *) TRANSPORT_COMPLETE_QF_WP (for TRANSPORT_WRITE_PENDING queue full)

    *) transport_send_check_condition_and_sense() failure paths in
    transport_generic_request_failure() and transport_generic_complete_ok()

    All logic is driven using se_device->qf_work_queue -> target_qf_do_work()
    to to requeue outstanding se_cmd at the head of se_dev->queue_obj->qobj_list
    for transport_processing_thread() execution.

    Tested using tcm_qla2xxx with MAX_OUTSTANDING_COMMANDS=128 for FCP READ
    to trigger the TRANSPORT_COMPLETE_OK queue full cases, and a simulated
    TFO->write_pending() -EAGAIN failure to trigger TRANSPORT_COMPLETE_QF_WP.

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

    Nicholas Bellinger
     
  • This patch adds a transport_handle_cdb_direct() optimization for mapping
    and queueing tasks directly from within fabric processing context by calling
    the newly exported transport_generic_new_cmd(). This currently expects to
    be called from process context only, and will fail if called within interrupt
    context.

    This patch also leaves transport_generic_handle_cdb() unmodified for the
    moment to function as expected with existing tcm_fc and ib_srpt fabrics,
    and will be removed once these have been converted and tested with v4.1
    code using transport_handle_cdb_direct().

    Based on Andy's original patch here:

    [PATCH 39/42] target: Call transport_new_cmd instead of adding to cmd queue

    Signed-off-by: Nicholas 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