1. 13 2月, 2014 1 次提交
  2. 30 1月, 2014 1 次提交
    • N
      target: Fix percpu_ref_put race in transport_lun_remove_cmd · 5259a06e
      Nicholas Bellinger 提交于
      This patch fixes a percpu_ref_put race for se_lun->lun_ref in
      transport_lun_remove_cmd() where ->lun_ref could end up being
      put more than once per command via different target completion
      and fabric release contexts.
      
      It adds a cmpxchg() for se_cmd->lun_ref_active to ensure that
      percpu_ref_put() is only ever called once per se_cmd.
      
      This bug was manifesting itself as a LUN shutdown regression
      bug in >= v3.13 code, where percpu_ref_kill() would end up
      hanging indefinately due to the incorrect percpu_ref count.
      
      (Change se_cmd->lun_ref_active from bool -> int to force at
       least a 4-byte cmpxchg with MIPS ll/sc ins. - Fengguang)
      Reported-by: NTommy Apel <tommyapeldk@gmail.com>
      Cc: Tommy Apel <tommyapeldk@gmail.com>
      Cc: <stable@vger.kernel.org> #3.13+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5259a06e
  3. 25 1月, 2014 1 次提交
  4. 18 1月, 2014 2 次提交
    • N
      target: Add protection SGLs to target_submit_cmd_map_sgls · def2b339
      Nicholas Bellinger 提交于
      This patch adds support to target_submit_cmd_map_sgls() for
      accepting 'sgl_prot' + 'sgl_prot_count' parameters for
      DIF protection information.
      
      Note the passed parameters are stored at se_cmd->t_prot_sg
      and se_cmd->t_prot_nents respectively.
      
      Also, update tcm_loop and vhost-scsi fabrics usage of
      target_submit_cmd_map_sgls() to take into account the
      new parameters.
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      def2b339
    • N
      target: Add DIF CHECK_CONDITION ASC/ASCQ exception cases · fcc4f17b
      Nicholas Bellinger 提交于
      This patch adds support for DIF related CHECK_CONDITION ASC/ASCQ
      exception cases into transport_send_check_condition_and_sense().
      
      This includes:
      
        LOGICAL BLOCK GUARD CHECK FAILED
        LOGICAL BLOCK APPLICATION TAG CHECK FAILED
        LOGICAL BLOCK REFERENCE TAG CHECK FAILED
      
      that used by DIF TYPE1 and TYPE3 failure cases.
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fcc4f17b
  5. 10 1月, 2014 1 次提交
  6. 21 11月, 2013 1 次提交
  7. 14 11月, 2013 1 次提交
    • N
      target: Fix delayed Task Aborted Status (TAS) handling bug · 29f4c090
      Nicholas Bellinger 提交于
      This patch fixes a bug in delayed Task Aborted Status (TAS) handling,
      where transport_send_task_abort() was not returning for the case
      when the se_tfo->write_pending() callback indicated that last fabric
      specific WRITE PDU had not yet been received.
      
      It also adds an explicit cmd->scsi_status = SAM_STAT_TASK_ABORTED
      assignment within transport_check_aborted_status() to avoid the case
      where se_tfo->queue_status() is called when the SAM_STAT_TASK_ABORTED
      assignment + ->queue_status() in transport_send_task_abort() does not
      occur once SCF_SENT_DELAYED_TAS has been set.
      
      Cc: <stable@vger.kernel.org> #3.2+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      29f4c090
  8. 13 11月, 2013 1 次提交
  9. 08 11月, 2013 2 次提交
    • N
      target: Drop left-over se_lun->lun_cmd_list shutdown code · 4a9a6c8d
      Nicholas Bellinger 提交于
      Now with percpu refcounting for se_lun in place, go ahead and drop
      the legacy per se_cmd accounting for se_lun shutdown.
      
      This includes __transport_clear_lun_from_sessions(), the associated
      transport_lun_wait_for_tasks() logic, along with a handful of now
      unused se_cmd structure members and ->transport_state bits.
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4a9a6c8d
    • N
      target: Add percpu refcounting for se_lun access · 5277797d
      Nicholas Bellinger 提交于
      This patch adds percpu refcounting for se_lun access that allows the
      association of an se_lun + se_cmd in transport_lookup_cmd_lun() to
      occur without an extra list_head for tracking outstanding I/O during
      se_lun shutdown.
      
      This effectively changes se_lun shutdown logic to wait for outstanding
      I/O percpu references to complete in transport_lun_remove_cmd() using
      se_lun->lun_ref_comp, instead of explicitly draining the per se_lun
      command list and waiting for individual se_cmd descriptor processing
      to complete.
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5277797d
  10. 02 10月, 2013 1 次提交
    • N
      target: Fall back to vzalloc upon ->sess_cmd_map kzalloc failure · 8c7f6e9b
      Nicholas Bellinger 提交于
      This patch changes transport_alloc_session_tags() to fall back to
      use vzalloc when kzalloc fails for big tag_num that end up generating
      larger order allocations.
      
      Also use is_vmalloc_addr() in transport_alloc_session_tags() failure
      path, and normal transport_free_session() path to determine when
      vfree() needs to be called instead of kfree().
      
      v2 changes:
        - Use  __GFP_NOWARN | __GFP_REPEAT for sess_cmd_map kzalloc (mst)
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8c7f6e9b
  11. 11 9月, 2013 4 次提交
    • N
      target: Update copyright ownership/year information to 2013 · 4c76251e
      Nicholas Bellinger 提交于
      Update copyright ownership/year information for target-core,
      loopback, iscsi-target, tcm_qla2xx, vhost and iser-target.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4c76251e
    • N
      target: Make helpers non static for EXTENDED_COPY command setup · c5ff8d6b
      Nicholas Bellinger 提交于
      Both target_alloc_sgl() and transport_generic_map_mem_to_cmd() are
      required by EXTENDED_COPY logic when setting up internally dispatched
      command descriptors, so go ahead and make both of these non static.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      c5ff8d6b
    • N
      target: Release COMPARE_AND_WRITE mutex in generic failure path · cf6d1f09
      Nicholas Bellinger 提交于
      This patch adds a extra check for SCF_COMPARE_AND_WRITE within
      transport_generic_request_failure() to invoke the callback for
      compare_and_write_callback() or compare_and_write_done(), in
      order to release se_dev->caw_mutex from the generic failure
      path.
      
      It also adds to checks within compare_and_write_callback() to
      avoid processing when transport_generic_request_failure() occurs
      early enough that cmd->t_data_sg or cmd->t_bidi_data_sg have not
      been setup yet, nor se_dev->caw_mutex obtained from within
      sbc_compare_and_write().
      
      v4 changes:
       - Add explicit check for cmd->transport_complete_callback in
         transport_generic_request_failure() to handle case where
         sbc_compare_and_write()clears callback pointer (Dan Carpenter)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      cf6d1f09
    • N
      target: Add compare_and_write_post() completion callback fall through · a2890087
      Nicholas Bellinger 提交于
      This patch changes target_complete_ok_work() to fall through
      after calling the se_cmd->transport_complete_callback() ->
      compare_and_write_post() callback, by keying off the existance
      of SCF_COMPARE_AND_WRITE_POST.
      
      This is necessary because once SCF_COMPARE_AND_WRITE_POST has
      been set by compare_and_write_post(), the SCSI response needs
      to be sent via TFO->queue_status().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a2890087
  12. 10 9月, 2013 8 次提交
    • N
      target: Make __target_execute_cmd() available as extern · 76dde50e
      Nicholas Bellinger 提交于
      Required by COMPARE_AND_WRITE for write instance user-data
      submission, in order to bypass target_execute_cmd() checks.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      76dde50e
    • N
      target: Add transport_reset_sgl_orig() for COMPARE_AND_WRITE · 47e459e6
      Nicholas Bellinger 提交于
      After COMPARE_AND_WRITE completes it's comparision, the WRITE
      payload SGLs head expect to be updated to point from the verify
      instance of user data, to the write instance of user data.
      
      So for this special case, add transport_reset_sgl_orig() usage
      within transport_free_pages() and add se_cmd->t_data_[sg,nents]_orig
      members to save the original assignments.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      47e459e6
    • N
      target: Do memory allocation for bidi commands using target_alloc_sgl · 8cefe07b
      Nicholas Bellinger 提交于
      This patch updates transport_generic_new_cmd() to call target_alloc_sgl()
      for SGL + page memory allocation for se_cmd->t_bidi_data_sg.
      
      It also adds the special case for SCF_COMPARE_AND_WRITE to calculate a
      different bidi_length based upon se_cmd->t_task_nolb.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      8cefe07b
    • N
      target: Refactor transport_generic_get_mem to target_alloc_sgl · 20093994
      Nicholas Bellinger 提交于
      This patch refactors transport_generic_get_mem() to target_alloc_sgl()
      for accepting **sgl, *nents, length and zero_page as function parameters
      in order to be used for both se_cmd->t_data_sg + se_cmd->t_bidi_data_sg
      allocations.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      20093994
    • N
      target: Convert se_cmd->t_bidi_data_sg checks to use SCF_BIDI · 64577407
      Nicholas Bellinger 提交于
      Stop keying off se_cmd->t_bidi_data_sg within transport_complete_qf()
      + target_complete_ok_work(), and just use SCF_BIDI instead.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      64577407
    • N
      target: Add TCM_MISCOMPARE_VERIFY sense handling · 818b571c
      Nicholas Bellinger 提交于
      This patch adds TCM_MISCOMPARE_VERIFY (ASC=0x1d, ASCQ=0x00) sense
      handling to transport_send_check_condition_and_sense(), which is
      required for a COMPARE_AND_WRITE comparision failure.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      818b571c
    • N
      target: Add return for se_cmd->transport_complete_callback · a6b0133c
      Nicholas Bellinger 提交于
      This patch adds a sense_reason_t return to ->transport_complete_callback(),
      and updates target_complete_ok_work() to invoke the call if necessary to
      transport_send_check_condition_and_sense() during the failure case.
      
      Also update xdreadwrite_callback() to use this return value.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a6b0133c
    • N
      target: Add transport_init_session_tags using per-cpu ida · c0add7fd
      Nicholas Bellinger 提交于
      This patch adds lib/idr.c based transport_init_session_tags() logic
      that allows fabric drivers to setup a per-cpu se_sess->sess_tag_pool
      and associated se_sess->sess_cmd_map for basic tagged pre-allocation
      of fabric descriptor sized memory.
      
      v5 changes:
        - Convert to percpu_ida.h include
      
      v4 changes:
        - Add transport_alloc_session_tags() for fabrics that need early
          transport_init_session()
      
      v3 changes:
        - Update to percpu-ida usage
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAsias He <asias@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c0add7fd
  13. 01 9月, 2013 1 次提交
    • N
      target: Fix se_cmd->state_list leak regression during WRITE failure · c130480b
      Nicholas Bellinger 提交于
      This patch addresses a v3.11 specific regression where se_cmd->state_list
      was being leaked during a fabric WRITE failure, when the fabric releases
      an associated se_cmd descriptor before I/O submission occurs, and normal
      fast path callbacks have a chance to call target_remove_from_state_list().
      
      It was manifesting with Poison overwritten messages with iscsi-target
      once an ImmediateData payload CRC32C failure occured.
      
      This bug was originally introduced during v3.11-rc1 with the following
      commit:
      
      commit 0b66818a
      Author: Nicholas Bellinger <nab@linux-iscsi.org>
      Date:   Thu Jun 6 01:36:41 2013 -0700
      
          target: Drop unnecessary CMD_T_DEV_ACTIVE check from transport_lun_remove_cmd
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c130480b
  14. 08 7月, 2013 1 次提交
    • R
      target: Add tracepoints for SCSI commands being processed · e5c0d6ad
      Roland Dreier 提交于
      This patch adds tracepoints to the target code for commands being
      received and being completed, which is quite useful for debugging
      interactions with initiators. For example, one can do something like the
      following to watch commands that are completing unsuccessfully:
      
          # echo 'scsi_status!=0' > /sys/kernel/debug/tracing/events/target/target_cmd_complete/filter
          # echo 1 > /sys/kernel/debug/tracing/events/target/target_cmd_complete/enable
      
              <run command that fails>
      
          # cat /sys/kernel/debug/tracing/trace
               iscsi_trx-0-1902  [003] ...1 990185.810385: target_cmd_complete: iqn.1993-08.org.debian:01:e51ede6aacfd <- LUN 001 status CHECK CONDITION (sense len 18 / 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00)  0x95 data_length    512  CDB 95 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  (TA:SIMPLE C:00)
      
      (v2: Drop undefined COMPARE_AND_WRITE)
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e5c0d6ad
  15. 21 6月, 2013 6 次提交
    • N
      target: Drop legacy se_cmd->check_release bit · ca24976a
      Nicholas Bellinger 提交于
      Now with iscsi-target using modern se_cmd->cmd_kref accounting in
      v3.10 code, it's safe to go ahead and drop the legacy release
      codepath + se_cmd->check_release bit in transport_release_cmd()
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ca24976a
    • N
      target: Drop unnecessary t_state_lock access for SCF_SUPPORTED_SAM_OPCODE assignment · b28e545c
      Nicholas Bellinger 提交于
      This patch drops the se_cmd->t_state_lock access around SCF_SUPPORTED_SAM_OPCODE
      assignment within target_setup_cmd_from_cdb().
      
      Original v4.0 target code required this as fabrics would be checking for
      this values in different process contexts for setup and I/O submission.
      
      Given that modern v4.1 target code performs setup and I/O submission
      from the same process context, this t_state_lock access is no longer
      required.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b28e545c
    • N
      target: Avoid extra t_state_lock access in __target_execute_cmd · 1a398b97
      Nicholas Bellinger 提交于
      This patch makes target_execute_cmd() set CMD_T_BUSY|CMD_T_SENT while
      holding se_cmd->t_state_lock, in order to avoid the extra aquire/release
      in __target_execute_cmd().
      
      It also clears these bits in case of a target_handle_task_attr()
      failure.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1a398b97
    • N
      target: Remove legacy t_fe_count + avoid t_state_lock access in transport_put_cmd · c1c35d52
      Nicholas Bellinger 提交于
      This patch removes legacy se_cmd->t_fe_count usage in order to avoid
      se_cmd->t_state_lock access within transport_put_cmd() during normal
      fast path se_cmd descriptor release.
      
      Also drop the left-over parameter usage within core_tmr_handle_tas_abort()
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c1c35d52
    • N
      target: Drop unnecessary CMD_T_DEV_ACTIVE check from transport_lun_remove_cmd · 0b66818a
      Nicholas Bellinger 提交于
      This patch drops an unnecessary acquire/release of se_cmd->t_state_lock within
      transport_lun_remove_cmd() when checking CMD_T_DEV_ACTIVE for invoking
      target_remove_from_state_list().
      
      For all fast path completion cases, transport_lun_remove_cmd() is always
      called ahead of transport_cmd_check_stop(), and since transport_cmd_check_stop()
      is calling target_remove_from_state_list() when remove_from_lists=true,
      the t_state_lock usage in transport_lun_remove_cmd() can safely be removed.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0b66818a
    • N
      target: Add transport_cmd_check_stop write_pending bit · 862e6389
      Nicholas Bellinger 提交于
      This patch adds a new transport_cmd_check_stop() parameter for signaling
      when TRANSPORT_WRITE_PENDING needs to be set.
      
      This allows transport_generic_new_cmd() to avoid the extra lock acquire/release
      of ->t_state_lock in the fast path for DMA_TO_DEVICE operations ahead of
      transport_cmd_check_stop() + se_tfo->write_pending().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Moussa Ba <moussaba@micron.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      862e6389
  16. 31 5月, 2013 1 次提交
  17. 30 5月, 2013 1 次提交
    • N
      target: Re-instate sess_wait_list for target_wait_for_sess_cmds · 9b31a328
      Nicholas Bellinger 提交于
      Switch back to pre commit 1c7b13fe list splicing logic for active I/O
      shutdown with tcm_qla2xxx + ib_srpt fabrics.
      
      The original commit was done under the incorrect assumption that it's safe to
      walk se_sess->sess_cmd_list unprotected in target_wait_for_sess_cmds() after
      sess->sess_tearing_down = 1 has been set by target_sess_cmd_list_set_waiting()
      during session shutdown.
      
      So instead of adding sess->sess_cmd_lock protection around sess->sess_cmd_list
      during target_wait_for_sess_cmds(), switch back to sess->sess_wait_list to
      allow wait_for_completion() + TFO->release_cmd() to occur without having to
      walk ->sess_cmd_list after the list_splice.
      
      Also add a check to exit if target_sess_cmd_list_set_waiting() has already
      been called, and add a WARN_ON to check for any fabric bug where new se_cmds
      are added to sess->sess_cmd_list after sess->sess_tearing_down = 1 has already
      been set.
      
      Cc: Joern Engel <joern@logfs.org>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9b31a328
  18. 21 5月, 2013 1 次提交
  19. 15 5月, 2013 1 次提交
  20. 04 5月, 2013 1 次提交
  21. 25 4月, 2013 2 次提交
  22. 29 3月, 2013 1 次提交
    • N
      target: Fix RESERVATION_CONFLICT status regression for iscsi-target special case · f85eda8d
      Nicholas Bellinger 提交于
      This patch fixes a regression introduced in v3.8-rc1 code where a failed
      target_check_reservation() check in target_setup_cmd_from_cdb() was causing
      an incorrect SAM_STAT_GOOD status to be returned during a WRITE operation
      performed by an unregistered / unreserved iscsi initiator port.
      
      This regression is only effecting iscsi-target due to a special case check
      for TCM_RESERVATION_CONFLICT within iscsi_target_erl1.c:iscsit_execute_cmd(),
      and was still correctly disallowing WRITE commands from backend submission
      for unregistered / unreserved initiator ports, while returning the incorrect
      SAM_STAT_GOOD status due to the missing SAM_STAT_RESERVATION_CONFLICT
      assignment.
      
      This regression was first introduced with:
      
      commit de103c93
      Author: Christoph Hellwig <hch@lst.de>
      Date:   Tue Nov 6 12:24:09 2012 -0800
      
          target: pass sense_reason as a return value
      
      Go ahead and re-add the missing SAM_STAT_RESERVATION_CONFLICT assignment
      during a target_check_reservation() failure, so that iscsi-target code
      sends the correct SCSI status.
      
      All other fabrics using target_submit_cmd_*() with a RESERVATION_CONFLICT
      call to transport_generic_request_failure() are not effected by this bug.
      Reported-by: NJeff Leung <jleung@curriegrad2004.ca>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f85eda8d