1. 14 10月, 2015 1 次提交
  2. 01 8月, 2015 1 次提交
  3. 02 6月, 2015 1 次提交
    • B
      target: Minimize SCSI header #include directives · ba929992
      Bart Van Assche 提交于
      Only include SCSI initiator header files in target code that needs
      these header files, namely the SCSI pass-through code and the tcm_loop
      driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in
      target code because the former is intended for initiator code and the
      latter for target code. With this patch the only initiator include
      directives in target code that remain are as follows:
      
      $ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
      drivers/target/loopback/tcm_loop.c:29:#include <scsi/scsi.h>
      drivers/target/loopback/tcm_loop.c:31:#include <scsi/scsi_host.h>
      drivers/target/loopback/tcm_loop.c:32:#include <scsi/scsi_device.h>
      drivers/target/loopback/tcm_loop.c:33:#include <scsi/scsi_cmnd.h>
      drivers/target/target_core_pscsi.c:39:#include <scsi/scsi_device.h>
      drivers/target/target_core_pscsi.c:40:#include <scsi/scsi_host.h>
      drivers/xen/xen-scsiback.c:52:#include <scsi/scsi_host.h> /* SG_ALL */
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJames Bottomley <JBottomley@Odin.com>
      ba929992
  4. 31 5月, 2015 2 次提交
  5. 04 12月, 2014 1 次提交
  6. 07 6月, 2014 1 次提交
  7. 16 5月, 2014 1 次提交
    • N
      tcm_fc: Fix free-after-use regression in ft_free_cmd · ed8ec8f7
      Nicholas Bellinger 提交于
      This patch fixes a free-after-use regression in ft_free_cmd(), where
      ft_sess_put() is called with cmd->sess after percpu_ida_free() has
      already released the tag.
      
      Fix this bug by saving the ft_sess pointer ahead of percpu_ida_free(),
      and pass it directly to ft_sess_put().
      
      The regression was originally introduced in v3.13-rc1 commit:
      
        commit 5f544cfa
        Author: Nicholas Bellinger <nab@daterainc.com>
        Date:   Mon Sep 23 12:12:42 2013 -0700
      
            tcm_fc: Convert to per-cpu command map pre-allocation of ft_cmd
      Reported-by: NJun Wu <jwu@stormojo.com>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: <stable@vger.kernel.org> #3.13+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ed8ec8f7
  8. 07 4月, 2014 1 次提交
    • N
      target: Add TFO->abort_task for aborted task resources release · 131e6abc
      Nicholas Bellinger 提交于
      Now that TASK_ABORTED status is not generated for all cases by
      TMR ABORT_TASK + LUN_RESET, a new TFO->abort_task() caller is
      necessary in order to give fabric drivers a chance to unmap
      hardware / software resources before the se_cmd descriptor is
      released via the normal TFO->release_cmd() codepath.
      
      This patch adds TFO->aborted_task() in core_tmr_abort_task()
      in place of the original transport_send_task_abort(), and
      also updates all fabric drivers to implement this caller.
      
      The fabric drivers that include changes to perform cleanup
      via ->aborted_task() are:
      
        - iscsi-target
        - iser-target
        - srpt
        - tcm_qla2xxx
      
      The fabric drivers that currently set ->aborted_task() to
      NOPs are:
      
        - loopback
        - tcm_fc
        - usb-gadget
        - sbp-target
        - vhost-scsi
      
      For the latter five, there appears to be no additional cleanup
      required before invoking TFO->release_cmd() to release the
      se_cmd descriptor.
      
      v2 changes:
        - Move ->aborted_task() call into transport_cmd_finish_abort (Alex)
      
      Cc: Alex Leung <amleung21@yahoo.com>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Vu Pham <vu@mellanox.com>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      131e6abc
  9. 24 1月, 2014 1 次提交
    • K
      percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask · 6f6b5d1e
      Kent Overstreet 提交于
      This patch changes percpu_ida_alloc() + callers to accept task state
      bitmask for prepare_to_wait() for code like target/iscsi that needs
      it for interruptible sleep, that is provided in a subsequent patch.
      
      It now expects TASK_UNINTERRUPTIBLE when the caller is able to sleep
      waiting for a new tag, or TASK_RUNNING when the caller cannot sleep,
      and is forced to return a negative value when no tags are available.
      
      v2 changes:
        - Include blk-mq + tcm_fc + vhost/scsi + target/iscsi changes
        - Drop signal_pending_state() call
      v3 changes:
        - Only call prepare_to_wait() + finish_wait() when != TASK_RUNNING
          (PeterZ)
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: NKent Overstreet <kmo@daterainc.com>
      Cc: <stable@vger.kernel.org> #3.12+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6f6b5d1e
  10. 02 10月, 2013 1 次提交
    • N
      tcm_fc: Convert to per-cpu command map pre-allocation of ft_cmd · 5f544cfa
      Nicholas Bellinger 提交于
      This patch converts tcm_fc to use transport_init_session_tags()
      pre-allocation logic for struct ft_cmd descriptors using per-cpu
      session tag pooling in order to effectively avoid memory allocation
      + release for each received I/O.
      
      It adds percpu_ida_alloc() in ft_recv_cmd() to obtain an tag and
      locate ft_cmd from se_sess->sess_cmd_map[], and percpu_ida_free()
      in ft_free_cmd() to release the tag based upon se_cmd->map_tag id.
      
      It also uses a TCM_FC_DEFAULT_TAGS value of 512, that puts the
      per se_sess->sess_cmd_map allocation at ~360K on 64-bit.
      
      v2 changes:
      
        - Handle possible tag < 0 failure with GFP_ATOMIC
      
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      5f544cfa
  11. 08 7月, 2013 2 次提交
  12. 18 9月, 2012 1 次提交
  13. 17 8月, 2012 1 次提交
  14. 18 7月, 2012 1 次提交
    • R
      target: Allow for target_submit_cmd() returning errors · d6dfc868
      Roland Dreier 提交于
      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 <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d6dfc868
  15. 17 7月, 2012 1 次提交
  16. 15 7月, 2012 1 次提交
    • M
      tcm_fc: Fix crash seen with aborts and large reads · 3cc5d2a6
      Mark Rustad 提交于
      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: NMark Rustad <mark.d.rustad@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3cc5d2a6
  17. 15 4月, 2012 1 次提交
  18. 07 4月, 2012 1 次提交
  19. 11 3月, 2012 2 次提交
    • N
      tcm_fc: Fix fc_exch memory leak in ft_send_resp_status · 031ed4d5
      Nicholas Bellinger 提交于
      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 <mark.d.rustad@intel.com>
      Cc: Kiran Patil <kiran.patil@intel.com>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      031ed4d5
    • N
      target: Drop unused legacy target_core_fabric_ops API callers · c7ec05c8
      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: NNicholas Bellinger <nab@linux-iscsi.org>
      c7ec05c8
  20. 26 2月, 2012 10 次提交
  21. 07 2月, 2012 1 次提交
    • A
      target: Change target_submit_cmd() to return void · 1edcdb49
      Andy Grover 提交于
      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: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1edcdb49
  22. 14 12月, 2011 2 次提交
    • N
      tcm_fc: Convert ft_send_work to use target_submit_cmd · 4355a911
      Nicholas Bellinger 提交于
      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 <hch@lst.de>
      Cc: Kiran Patil <kiran.patil@intel.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4355a911
    • 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
  23. 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
  24. 02 11月, 2011 1 次提交
    • N
      target: Make TFO->check_stop_free return free status · 88dd9e26
      Nicholas Bellinger 提交于
      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: NNicholas Bellinger <nab@risingtidesystems.com>
      88dd9e26
  25. 24 10月, 2011 3 次提交