22 Jul, 2011

40 commits

  • 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
     
  • This patch contains a squashed version to remove unused SCF_* flags:

    target: remove the unused SCF_SE_DISABLE_ONLINE_CHECK flag
    target: remove the unused SCF_CMD_PASSTHROUGH_NOALLOC flag
    target: remove the unused SCF_EMULATE_SYNC_UNMAP flag
    target: remove the unused SCF_EMULATE_SYNC_CACHE flag

    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
     
  • This patch fixes the handling of WRITE_SAME_[16,32] emulation where a
    WRITE_SAME_* CDB with number of blocks=0 was being rejected by SCSI
    expected data transfer length overflow checking in target core.

    It changes both CDB cases in transport_generic_cmd_sequencer() to use
    dev->se_sub_dev->se_dev_attrib.block_size to match what sg_write_same
    is sending us with --num=0. It also fixes target_emulate_write_same()
    to properly determine the num_blocks with --num=0 case to determine the
    remaining range for dev->transport->do_discard().

    Reported-by: Chris Greiveldinger
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • This patch fixes a bug in the assignment of cmd->t_task.t_task_lba with
    WRITE_SAME_16 to correctly use get_unaligned_be64() for the 64-bit LBA.

    Reported-by: Chris Greiveldinger
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • This patch contains the squashed version of second round of target core
    cleanups and simplifications and Andy and Co. It also contains a handful
    of fixes to address bugs the original series and other minor cleanups.

    Here is the condensed shortlog:

    target: Remove unneeded casts to void*
    target: Rename get_lun_for_{cmd,tmr} to lookup_{cmd,tmr}_lun
    target: Make t_task a member of se_cmd, not a pointer
    target: Handle functions returning "-2"
    target: Use cmd->se_dev over cmd->se_lun->lun_se_dev
    target: Embed qr in struct se_cmd
    target: Replace embedded struct se_queue_req with a list_head
    target: Rename list_heads that are nodes in struct se_cmd to "*_node"
    target: Fold transport_device_setup_cmd() into lookup_{tmr,cmd}_lun()
    target: Make t_mem_list and t_mem_list_bidi members of t_task
    target: Add comment & cleanup transport_map_sg_to_mem()
    target: Remove unneeded checks in transport_free_pages()

    (Roland: Fix se_queue_req removal leftovers OOPs)
    (nab: Fix transport_lookup_tmr_lun failure case)
    (nab: Fix list_empty(&cmd->t_task.t_mem_bidi_list) inversion bugs)

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

    Andy Grover
     
  • The code in transport_add_device_to_core_hba() really intends to make sure
    that neither inquiry_prod nor inquiry_rev is NULL.

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

    Roland Dreier
     
  • This patch contains the squashed version of a number of cleanups and
    minor fixes from Andy's initial series (round 1) for target core this
    past spring. The condensed log looks like:

    target: use errno values instead of returning -1 for everything
    target: Rename transport_calc_sg_num to transport_init_task_sg
    target: Fix leak in error path in transport_init_task_sg
    target/pscsi: Remove pscsi_get_sh() usage
    target: Make two runtime checks into WARN_ONs
    target: Remove hba queue depth and convert to spin_lock_irq usage
    target: dev->dev_status_queue_obj is unused
    target: Make struct se_queue_req.cmd type struct se_cmd *
    target: Remove __transport_get_qr_from_queue()
    target: Rename se_dev->g_se_dev_list to se_dev_node
    target: Remove struct se_global
    target: Simplify scsi mib index table code
    target: Make dev_queue_obj a member of se_device instead of a pointer
    target: remove extraneous returns at end of void functions
    target: Ensure transport_dump_vpd_ident_type returns null-terminated str
    target: Function pointers don't need to use '&' to be assigned
    target: Fix comment in __transport_execute_tasks()
    target: Misc style cleanups
    target: rename struct pr_reservation_template to pr_reservation
    target: Remove #defines that just perform indirection
    target: Inline transport_get_task_from_execute_queue()
    target: Minor header comment fixes

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

    Andy Grover
     
  • This patch removes two instances of left over v3.x code performing local
    scope access to struct target_core_fabric_ops->tf_subsys->su_group in
    target_fabric_configfs_register() and target_fabric_configfs_deregister().

    Reported-by: Christophe Fergeau
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • This patch removes the now unnecessary 'unsigned char *cdb' function
    parameter from transport_get_lun_for_cmd(). This also includes updating
    lio-target, tcm_loop and tcm_fc usage of transport_get_lun_for_cmd().

    Reported-by: Fubo Chen
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • Signed-off-by: FUJITA Tomonori
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • This patch checks the passed 'unpacked_lun' against TRANSPORT_MAX_LUNS_PER_TPG
    before reading from struct se_node_acl->device_list[].

    Signed-off-by: Fubo Chen
    Signed-off-by: Nicholas A. Bellinger

    Fubo Chen
     
  • Linus Torvalds
     
  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
    sparc,kgdbts: fix compile regression with kgdb test suite

    Linus Torvalds
     
  • Commit 63ab25ebbc (kgdbts: unify/generalize gdb breakpoint adjustment)
    introduced a compile regression on sparc.

    kgdbts.c: In function 'check_and_rewind_pc':
    kgdbts.c:307: error: implicit declaration of function 'instruction_pointer_set'

    Simply add the correct macro definition for instruction pointer on the
    Sparc architecture.

    Signed-off-by: Jason Wessel
    Acked-by: Mike Frysinger
    Acked-by: David S. Miller

    Jason Wessel
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    CIFS: Fix wrong length in cifs_iovec_read

    Linus Torvalds
     
  • …/git/tip/linux-2.6-tip

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86: Make Dell Latitude E6420 use reboot=pci
    x86: Make Dell Latitude E5420 use reboot=pci

    Linus Torvalds
     
  • Yet another variant of the Dell Latitude series which requires
    reboot=pci.

    From the E5420 bug report by Daniel J Blueman:

    > The E6420 is affected also (same platform, different casing and
    > features), which provides an external confirmation of the issue; I can
    > submit a patch for that later or include it if you prefer:
    > http://linux.koolsolutions.com/2009/08/04/howto-fix-linux-hangfreeze-during-reboots-and-restarts/

    Reported-by: Daniel J Blueman
    Signed-off-by: H. Peter Anvin
    Cc:

    H. Peter Anvin