1. 22 7月, 2011 16 次提交
    • A
      target: Eliminate usage of struct se_mem · ec98f782
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ec98f782
    • A
      target: Pass 2nd param of transport_split_cdb by value · 3a867205
      Andy Grover 提交于
      Since sectors is not modified, it's more straightforward to do this.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3a867205
    • A
      target: Enforce 1 page max for control cdb buffer sizes · d0229ae3
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d0229ae3
    • A
      target: Make all control CDBs scatter-gather · 05d1c7c0
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      05d1c7c0
    • N
      target: Add SCF_EMULATE_QUEUE_FULL -> transport_handle_queue_full · 07bde79a
      Nicholas Bellinger 提交于
      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: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      07bde79a
    • N
      target: Add transport_handle_cdb_direct optimization · 695434e1
      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: NNicholas Bellinger <nab@linux-iscsi.org>
      695434e1
    • C
      target: merge release_cmd methods · 35462975
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      35462975
    • C
      target: remove the unused SCF_* flags · db1620a2
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      db1620a2
    • C
    • A
      target: Updates from AGrover and HCH (round 3) · a1d8b49a
      Andy Grover 提交于
      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 sg<->buf 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: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a1d8b49a
    • N
      target: Fix WRITE_SAME_[16,32] number of blocks=0 case · dd3a5ad8
      Nicholas Bellinger 提交于
      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: NChris Greiveldinger <chris.greiveldinger@rnanetworks.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      dd3a5ad8
    • N
      target: Fix WRITE_SAME_16 t_task_lba assignment bug · 1eb437a4
      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: NChris Greiveldinger <chris.greiveldinger@rnanetworks.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      1eb437a4
    • A
      target: More core cleanups from AGrover (round 2) · 5951146d
      Andy Grover 提交于
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5951146d
    • R
      target: Fix double test of inquiry_prod · f22c1196
      Roland Dreier 提交于
      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: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      f22c1196
    • A
      target: Core cleanups from AGrover (round 1) · e3d6f909
      Andy Grover 提交于
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e3d6f909
    • N
  2. 24 6月, 2011 1 次提交
  3. 27 5月, 2011 4 次提交
    • N
      [SCSI] target: Convert TASK_ATTR to scsi_tcq.h definitions · 61db1802
      Nicholas Bellinger 提交于
      This patch converts target core and follwing scsi-misc upstream fabric
      modules to use include/scsi/scsi_tcq.h includes for SIMPLE, HEAD_OF_QUEUE
      and ORDERED SCSI tasks instead of scsi/libsas.h with TASK_ATTR*
      
      *) tcm_loop: Convert tcm_loop_allocate_core_cmd() + tcm_loop_device_reset() to
         scsi_tcq.h
      *) tcm_fc: Convert ft_send_cmd() from FCP_PTA_* to scsi_tcq.h
      Reported-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      61db1802
    • N
      [SCSI] target: Fix task->task_execute_queue=1 clear bug + LUN_RESET OOPs · ccf4d680
      Nicholas Bellinger 提交于
      This patch fixes a bug where task->task_execute_queue=1 was not being
      cleared once se_task had been removed from se_device->execute_task_list,
      resulting in an OOPs in core_tmr_lun_reset() for the task->task_active=0
      case where transport_remove_task_from_execute_queue() was incorrectly
      being called.
      
      This patch fixes two cases in transport_get_task_from_execute_queue()
      and transport_remove_task_from_execute_queue() to properly clear
      task->task_execute_queue=0 once list_del(&task->t_execute_list) has
      been called.
      
      It also adds an explict check in transport_remove_task_from_execute_queue()
      to dump_stack + return if called with task->task_execute_queue=0.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      ccf4d680
    • N
      [SCSI] target: Fix bug with task_sg chained transport_free_dev_tasks release · 42c6951e
      Nicholas Bellinger 提交于
      This patch addresses a bug in the target core release path for HW
      operation where transport_free_dev_tasks() was incorrectly being called
      from transport_lun_remove_cmd() while releasing a se_cmd reference and
      calling struct target_core_fabric_ops->queue_data_in().
      
      This would result in a OOPs with HW target mode when the release of
      se_task->task_sg[] would happen before pci_unmap_sg() can be called in
      HW target mode fabric module code.  This patch addresses the issue by
      moving transport_free_dev_tasks() from transport_lun_remove_cmd() into
      transport_generic_free_cmd(), and adding TRANSPORT_FREE_CMD_INTR and
      transport_generic_free_cmd_intr() to allow se_cmd descriptor release
      to happen fromfrom within transport_processing_thread() process context
      when release of se_cmd is not possible from HW interrupt context.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      42c6951e
    • N
      [SCSI] target: Fix multi task->task_sg[] chaining logic bug · 4a8fcc2c
      Nicholas Bellinger 提交于
      This patch fixes a bug in transport_do_task_sg_chain() used by HW target
      mode modules with sg_chain() to provide a single sg_next() walkable memory
      layout for use with pci_map_sg() and friends.  This patch addresses an
      issue with mapping multiple small block max_sector tasks across multiple
      struct se_task->task_sg[] mappings for HW target mode operation.
      
      This was causing OOPs with (cmd->t_task->t_tasks_no > 1) I/O traffic for
      HW target drivers using transport_do_task_sg_chain(), and has been tested
      so far with tcm_fc(openfcoe), tcm_qla2xxx, and ib_srpt fabrics with
      t_tasks_no > 1 IBLOCK backends using a smaller max_sectors to trigger the
      original issue.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Acked-by: NKiran Patil <kiran.patil@intel.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      4a8fcc2c
  4. 25 5月, 2011 4 次提交
    • N
      [SCSI] target: Convert TASK_ATTR to scsi_tcq.h definitions · e66ecd50
      Nicholas Bellinger 提交于
      This patch converts target core and follwing scsi-misc upstream fabric
      modules to use include/scsi/scsi_tcq.h includes for SIMPLE, HEAD_OF_QUEUE
      and ORDERED SCSI tasks instead of scsi/libsas.h with TASK_ATTR*
      
      *) tcm_loop: Convert tcm_loop_allocate_core_cmd() + tcm_loop_device_reset() to
         scsi_tcq.h
      *) tcm_fc: Convert ft_send_cmd() from FCP_PTA_* to scsi_tcq.h
      Reported-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      e66ecd50
    • N
      [SCSI] target: Fix task->task_execute_queue=1 clear bug + LUN_RESET OOPs · af57c3ac
      Nicholas Bellinger 提交于
      This patch fixes a bug where task->task_execute_queue=1 was not being
      cleared once se_task had been removed from se_device->execute_task_list,
      resulting in an OOPs in core_tmr_lun_reset() for the task->task_active=0
      case where transport_remove_task_from_execute_queue() was incorrectly
      being called.
      
      This patch fixes two cases in transport_get_task_from_execute_queue()
      and transport_remove_task_from_execute_queue() to properly clear
      task->task_execute_queue=0 once list_del(&task->t_execute_list) has
      been called.
      
      It also adds an explict check in transport_remove_task_from_execute_queue()
      to dump_stack + return if called with task->task_execute_queue=0.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      af57c3ac
    • N
      [SCSI] target: Fix bug with task_sg chained transport_free_dev_tasks release · f4366772
      Nicholas Bellinger 提交于
      This patch addresses a bug in the target core release path for HW
      operation where transport_free_dev_tasks() was incorrectly being called
      from transport_lun_remove_cmd() while releasing a se_cmd reference and
      calling struct target_core_fabric_ops->queue_data_in().
      
      This would result in a OOPs with HW target mode when the release of
      se_task->task_sg[] would happen before pci_unmap_sg() can be called in
      HW target mode fabric module code.  This patch addresses the issue by
      moving transport_free_dev_tasks() from transport_lun_remove_cmd() into
      transport_generic_free_cmd(), and adding TRANSPORT_FREE_CMD_INTR and
      transport_generic_free_cmd_intr() to allow se_cmd descriptor release
      to happen fromfrom within transport_processing_thread() process context
      when release of se_cmd is not possible from HW interrupt context.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      f4366772
    • N
      [SCSI] target: Fix multi task->task_sg[] chaining logic bug · 97868c89
      Nicholas Bellinger 提交于
      This patch fixes a bug in transport_do_task_sg_chain() used by HW target
      mode modules with sg_chain() to provide a single sg_next() walkable memory
      layout for use with pci_map_sg() and friends.  This patch addresses an
      issue with mapping multiple small block max_sector tasks across multiple
      struct se_task->task_sg[] mappings for HW target mode operation.
      
      This was causing OOPs with (cmd->t_task->t_tasks_no > 1) I/O traffic for
      HW target drivers using transport_do_task_sg_chain(), and has been tested
      so far with tcm_fc(openfcoe), tcm_qla2xxx, and ib_srpt fabrics with
      t_tasks_no > 1 IBLOCK backends using a smaller max_sectors to trigger the
      original issue.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      Acked-by: NKiran Patil <kiran.patil@intel.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
      97868c89
  5. 10 4月, 2011 1 次提交
  6. 31 3月, 2011 1 次提交
  7. 24 3月, 2011 4 次提交
  8. 02 3月, 2011 1 次提交
  9. 01 3月, 2011 1 次提交
    • N
      [SCSI] target: Fix t_transport_aborted handling in LUN_RESET + active I/O shutdown · 52208ae3
      Nicholas Bellinger 提交于
      This patch addresses two outstanding bugs related to
      T_TASK(cmd)->t_transport_aborted handling during TMR LUN_RESET and
      active I/O shutdown.
      
      This first involves adding two explict t_transport_aborted=1
      assignments in core_tmr_lun_reset() in order to signal the task has
      been aborted, and updating transport_generic_wait_for_tasks() to skip
      sleeping when t_transport_aborted=1 has been set.  This fixes an issue
      where transport_generic_wait_for_tasks() would end up sleeping
      indefinately when called from fabric module context while TMR
      LUN_RESET was happening with long outstanding backend struct se_task
      not yet being completed.
      
      The second adds a missing call to
      transport_remove_task_from_execute_queue() when
      task->task_execute_queue=1 is set in order to fix an OOPs when
      task->t_execute_list has not been dropped.  It also fixes the same
      case in transport_processing_shutdown() to prevent the issue from
      happening during active I/O struct se_device shutdown.
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      52208ae3
  10. 13 2月, 2011 2 次提交
  11. 15 1月, 2011 1 次提交
    • N
      [SCSI] target: Add LIO target core v4.0.0-rc6 · c66ac9db
      Nicholas Bellinger 提交于
      LIO target is a full featured in-kernel target framework with the
      following feature set:
      
      High-performance, non-blocking, multithreaded architecture with SIMD
      support.
      
      Advanced SCSI feature set:
      
          * Persistent Reservations (PRs)
          * Asymmetric Logical Unit Assignment (ALUA)
          * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
          * Full Error Recovery (ERL=0,1,2)
          * Active/active task migration and session continuation (ERL=2)
          * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
      
      Multiprotocol target plugins
      
      Storage media independence:
      
          * Virtualization of all storage media; transparent mapping of IO to LUNs
          * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
          * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
      
      Standards compliance:
      
          * Full compliance with IETF (RFC 3720)
          * Full implementation of SPC-4 PRs and ALUA
      
      Significant code cleanups done by Christoph Hellwig.
      
      [jejb: fix up for new block bdev exclusive interface. Minor fixes from
       Randy Dunlap and Dan Carpenter.]
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      c66ac9db