1. 08 9月, 2012 1 次提交
    • P
      target: go through normal processing for zero-length PSCSI commands · 306c11b2
      Paolo Bonzini 提交于
      Right now, commands with a zero-size payload are skipped completely.
      This is wrong; such commands should be passed down to the device and
      processed normally.
      
      For physical backends, this ignores completely things such as START
      STOP UNIT.  For virtual backends, we have a hack in place to clear a
      unit attention state on a zero-size REQUEST SENSE, but we still do
      not report errors properly on zero-length commands---out-of-bounds
      0-block reads and writes, too small parameter list lengths, etc.
      
      This patch fixes this for PSCSI.  Uses of transport_kmap_data_sg are
      guarded with a check for non-zero cmd->data_length; for all other
      commands a zero length is handled properly in pscsi_execute_cmd.
      The sole exception will be for now REPORT LUNS, which is handled
      through the normal SPC emulation.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      306c11b2
  2. 06 9月, 2012 1 次提交
  3. 17 8月, 2012 1 次提交
    • N
      target/pscsi: Fix bug with REPORT_LUNs handling for SCSI passthrough · 1d2a2cd9
      Nicholas Bellinger 提交于
      This patch fixes a regression bug in pscsi_transport_complete() callback
      code where *pt was being NULL dereferenced during REPORT_LUNS handling,
      that was introduced with the spc/sbc refactoring in:
      
      commit 1fd032ee
      Author: Christoph Hellwig <hch@infradead.org>
      Date:   Sun May 20 11:59:15 2012 -0400
      
          target: move code for CDB emulation
      
      As this is a special case for pscsi_parse_cdb() to call spc_parse_cdb() to
      allow TCM to handle REPORT_LUN emulation, pscsi_plugin_task will have not
      been allocated..
      
      So now in pscsi_transport_complete() just check for existence of *pt and
      return for this special case.
      Reported-by: NAlex Elsayed <eternaleye+usenet@gmail.com>
      Cc: Alex Elsayed <eternaleye+usenet@gmail.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1d2a2cd9
  4. 17 7月, 2012 6 次提交
  5. 07 5月, 2012 3 次提交
  6. 26 2月, 2012 1 次提交
  7. 18 1月, 2012 1 次提交
  8. 14 12月, 2011 4 次提交
    • N
      target: Drop se_device TCQ queue_depth usage from I/O path · 65586d51
      Nicholas Bellinger 提交于
      Historically, pSCSI devices have been the ones that required target-core
      to enforce a per se_device->depth_left.  This patch changes target-core
      to no longer (by default) enforce a per se_device->depth_left or sleep in
      transport_tcq_window_closed() when we out of queue slots for all backend
      export cases.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      65586d51
    • J
      target: remove useless casts · 8359cf43
      Jörn Engel 提交于
      A reader should spend an extra moment whenever noticing a cast,
      because either something special is going on that deserves extra
      attention or, as is all too often the case, the code is wrong.
      
      These casts, afaics, have all been useless.  They cast a foo* to a
      foo*, cast a void* to the assigned type, cast a foo* to void*, before
      assigning it to a void* variable, etc.
      
      In a few cases I also removed an additional &...[0], which is equally
      useless.
      
      Lastly I added three FIXMEs where, to the best of my judgement, the
      code appears to have a bug.  It would be good if someone could check
      these.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8359cf43
    • S
      target: use \n as a separator for configuration · 90c161b6
      Sebastian Andrzej Siewior 提交于
      The command
      | echo rd_pages=32768 > ramdisk/control
      
      Does not work because it writes "rd_pages=32768\n" and the parser which
      matches for "rd_pages=%d" does not recognize it due to the \n. One way
      of fixing this would be using "echo -n" instead.
      This patch adds \n to the list of separators so we don't have to use the
      -n argument which I find is more convinient.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      90c161b6
    • C
      target: header reshuffle, part2 · c4795fb2
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c4795fb2
  9. 06 12月, 2011 1 次提交
    • N
      target: Address legacy PYX_TRANSPORT_* return code breakage · 03e98c9e
      Nicholas Bellinger 提交于
      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 <hch@lst.de>
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      03e98c9e
  10. 02 11月, 2011 1 次提交
  11. 01 11月, 2011 1 次提交
  12. 24 10月, 2011 5 次提交
  13. 11 10月, 2011 1 次提交
  14. 15 9月, 2011 1 次提交
  15. 22 7月, 2011 7 次提交
    • N
      target: ->map_task_SG conversion to ->map_control_SG and ->map_data_SG · 1d20bb61
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1d20bb61
    • A
      target: Follow up core updates from AGrover and HCH (round 4) · 6708bb27
      Andy Grover 提交于
      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: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6708bb27
    • 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: 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
    • 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
    • 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
    • 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
  16. 27 5月, 2011 1 次提交
  17. 25 5月, 2011 1 次提交
  18. 24 3月, 2011 3 次提交