1. 15 4月, 2012 4 次提交
    • A
      target/iscsi: Misc cleanups from Agrover (round 2) · 8b1e1244
      Andy Grover 提交于
      This patch includes the handful of squashed patches for target/iscsi from
      Andy's original series into lio-core/master code:
      
      *) Make iscsit_add_reject static
      *) Remove unused data_offset_end from iscsi_datain_req
      *) Remove "#if 0" stubs
      *) Rename iscsi_datain_req to cmd_datain_node
      *) Cleanups for built_r2ts_for_cmd()
      *) Cleanups for Cleanup build_sendtargets_response()
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8b1e1244
    • R
      target: Remove transport_do_task_sg_chain() and associated detritus · 957525a2
      Roland Dreier 提交于
      Now that all fabrics are converted over to using se_cmd->t_data_sg
      directly, we can drop the task sg chaining support.  With the modern
      memory allocation in target core, task sg chaining is needless
      overhead -- we would split up the main cmd sglist into pieces, and
      then splice those pieces back together instead of just using the
      original list directly.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      957525a2
    • C
      target: stop splitting commands into multiple tasks · bebe2fdc
      Christoph Hellwig 提交于
      From hch:
      
      The high-performance backends (iblock and rd) support tasks of unlimited
      size.  With that there is no reason to keep a complex infrastructure for
      splitting up commands in place.  Stop doing so and only submit a single
      task per data direction.  Once this is in place we can slowly remove fields
      from the task that duplicate things in the command, or move other fields
      into the command.
      
      From nab:
      
      The benefit to IBLOCK performance by removing the additional
      fast-path allocation overhead + SGL mapping to se_task->task_sg[] is now
      greater than transparently supporting an received CDB I/O length that
      exceeds what is allowed by backend pSCSI LLD hardware max_sectors, that
      was originally supported for all backend export cases.
      
      This change may effect some users of pSCSI users on legacy hardware, but
      I think most folks are now using TYPE_DISK struct scsi_device export
      with IBLOCK.  The only other place where this may can issues that cannot
      be resolved with IBLOCK TYPE_DISK is using TYPE_ROM, TYPE_TAPE or other
      pSCSI non TYPE_DISK export with an SCSI LLDs using a smaller
      max_sectors.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bebe2fdc
    • S
      target: add unknown size flag to target_submit_cmd() · b0d79946
      Sebastian Andrzej Siewior 提交于
      The UASP protocol does not inform the target device upfront how much
      data it should expect so we have to learn in from the CDB.  So in order
      to handle this case, add a TARGET_SCF_UNKNOWN_SIZE to target_submit_cmd()
      and perform an explictly assignment for se_cmd->data_length from the
      extracted CDB size in transport_generic_cmd_sequencer().
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b0d79946
  2. 20 3月, 2012 1 次提交
  3. 16 3月, 2012 1 次提交
  4. 14 3月, 2012 1 次提交
    • N
      target: Fix compatible reservation handling (CRH=1) with legacy RESERVE/RELEASE · 087a03b3
      Nicholas Bellinger 提交于
      This patch addresses a bug with target_check_scsi2_reservation_conflict()
      return checking in target_scsi2_reservation_[reserve,release]() that was
      preventing CRH=1 operation from silently succeeding in the two special
      cases defined by SPC-3, and not failing with reservation conflict status
      when dealing with legacy RESERVE/RELEASE + active SPC-3 PR logic.
      
      Also explictly set cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT during
      the early non reservation holder failure from pr_ops->t10_seq_non_holder()
      check in transport_generic_cmd_sequencer() for fabrics that already expect
      it to be set.
      
      This bug was originally introduced in mainline commit:
      
      commit eacac00c
      Author: Christoph Hellwig <hch@infradead.org>
      Date:   Thu Nov 3 17:50:40 2011 -0400
      
          target: split core_scsi2_emulate_crh
      Reported-by: NMartin Svec <martin.svec@zoner.cz>
      Cc: Martin Svec <martin.svec@zoner.cz>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      087a03b3
  5. 11 3月, 2012 5 次提交
    • N
      target: Convert se_node_acl->acl_group removal to use ->acl_kref · 337c0607
      Nicholas Bellinger 提交于
      This patch converts core_tpg_del_initiator_node_acl() shutdown from configfs
      context to use se_node_acl->acl_kref and ->acl_free_comp in order to wait for
      outstanding fabric callbacks to complete via transport_deregister_session()
      callbacks before waking ->acl_free_comp from the last ->acl_kref put.
      
      It also changes core_tpg_del_initiator_node_acl() to setup a local sess_list
      with target_get_session() + acl->acl_stop = 1 for active sessions that will
      be shutdown, and changes transport_deregister_session_configfs() to check
      for ->acl_stop usage.
      
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      337c0607
    • N
      target: Add se_node_acl->acl_kref for ->acl_free_comp usage · afb999ff
      Nicholas Bellinger 提交于
      This patch adds se_node_acl->acl_kref for use with ->acl_free_comp
      during explict se_node_acl release.  It adds kref_init() during
      se_node_acl setup, kref_get() during __transport_register_session()
      -> target_put_nacl() with existing transport_deregister_session()
      fabric callback usage.
      
      It also moves transport_free_session() to release *se_sess memory
      after target_put_nacl() execution in transport_deregister_session()
      
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      afb999ff
    • N
      target: Add se_node_acl->acl_free_comp for NodeACL release path · 01468346
      Nicholas Bellinger 提交于
      Add se_node_acl->acl_free_comp for NodeACL release path to wait for outstanding
      fabric session shutdown to complete in transport_deregister_session() before
      finishing NodeACL release from configfs process context.
      
      Also make transport_deregister_session() clear the comp_nacl bit
      to skip se_node_acl->acl_free_comp completion for dynamically generated
      NodeACL during fabric session shutdown.
      
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      01468346
    • N
      target: Add se_sess->sess_kref + get/put helpers · 41ac82b6
      Nicholas Bellinger 提交于
      This patch adds basic se_session->sess_kref and get/put helpers for fabric
      session reference counting.  It sets the initial kref in transport_init_session()
      and adds a target_release_session() callback to invoke TFO->close_session()
      for final session shutdown.
      
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      41ac82b6
    • N
      target: Convert session_lock to irqsave · 140854cb
      Nicholas Bellinger 提交于
      This patch converts the remaining struct se_portal_group->session_lock
      usage to use irqsave+irqrestore to address the following warnings for
      hardware target mode interrupt context usage.  This change generate
      other warnings for current iscsi-target mode still using ->session_lock
      with spin_lock_bh, which will need to be converted in a seperate patch.
      
      [  492.480728] [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
      [  492.488194] 3.0.0+ #23
      [  492.490820] ------------------------------------------------------
      [  492.497704] sh/7162 [HC0[0]:SC0[2]:HE0:SE0] is trying to acquire:
      [  492.504493] (&(&se_tpg->session_lock)->rlock){+.....}, at: [<ffffffffa022364d>] transport_deregister_session+0x2d/0x163 [target_core_mod]
        492.518390]
      [  492.518390] and this task is already holding:
      [  492.524897] (&(&ha->hardware_lock)->rlock){-.-...}, at: [<ffffffffa00b9146>] qla_tgt_stop_phase1+0x5e/0x27e [qla2xxx]
      [  492.536856] which would create a new lock dependency:
      [  492.542481] (&(&ha->hardware_lock)->rlock){-.-...} -> (&(&se_tpg->session_lock)->rlock){+.....}
      [  492.552321]
      [  492.552321] but this new dependency connects a HARDIRQ-irq-safe lock:
      [  492.561149] (&(&ha->hardware_lock)->rlock){-.-...}
      [  492.566400] ... which became HARDIRQ-irq-safe at:
      [  492.571841]   [<ffffffff81064720>] __lock_acquire+0x68f/0x921
      [  492.578247]   [<ffffffff81064eff>] lock_acquire+0xe0/0x10d
      [  492.584367]   [<ffffffff813a74c6>] _raw_spin_lock_irqsave+0x44/0x56
      [  492.591358]   [<ffffffffa009b1be>] qla24xx_msix_default+0x5c/0x2aa [qla2xxx]
      [  492.599227]   [<ffffffff81088582>] handle_irq_event_percpu+0x5a/0x197
      [  492.606413]   [<ffffffff810886fb>] handle_irq_event+0x3c/0x5c
      [  492.612822]   [<ffffffff8108a6dc>] handle_edge_irq+0xcc/0xf1
      [  492.619138]   [<ffffffff810039b9>] handle_irq+0x83/0x8e
      [  492.624971]   [<ffffffff8100333e>] do_IRQ+0x48/0xaf
      [  492.630413]   [<ffffffff813a7cd3>] ret_from_intr+0x0/0x1a
      [  492.636437]   [<ffffffff81001dc1>] cpu_idle+0x5b/0x8d
      [  492.642073]   [<ffffffff81392709>] rest_init+0xad/0xb4
      [  492.647809]   [<ffffffff81a1cbbc>] start_kernel+0x366/0x371
      [  492.654030]   [<ffffffff81a1c2b1>] x86_64_start_reservations+0xb8/0xbc
      [  492.661311]   [<ffffffff81a1c3b6>] x86_64_start_kernel+0x101/0x110
      [  492.668204]
      [  492.668205] to a HARDIRQ-irq-unsafe lock:
      [  492.674324] (&(&se_tpg->session_lock)->rlock){+.....}
      [  492.679862] ... which became HARDIRQ-irq-unsafe at:
      [  492.685497] ...  [<ffffffff8106479a>] __lock_acquire+0x709/0x921
      [  492.692209]   [<ffffffff81064eff>] lock_acquire+0xe0/0x10d
      [  492.698330]   [<ffffffff813a75ed>] _raw_spin_lock_bh+0x31/0x40
      [  492.704836]   [<ffffffffa021c208>] core_tpg_del_initiator_node_acl+0x89/0x336 [target_core_mod]
      [  492.714546]   [<ffffffffa02fb075>] tcm_qla2xxx_drop_nodeacl+0x20/0x2d [tcm_qla2xxx]
      [  492.723087]   [<ffffffffa02108d9>] target_fabric_nacl_base_release+0x22/0x24 [target_core_mod]
      [  492.732698]   [<ffffffffa01661c8>] config_item_release+0x7d/0xa3 [configfs]
      [  492.740465]   [<ffffffff811d48fe>] kref_put+0x43/0x4d
      [  492.746101]   [<ffffffffa0166149>] config_item_put+0x19/0x1b [configfs]
      [  492.753481]   [<ffffffffa0164987>] configfs_rmdir+0x1eb/0x258 [configfs]
      [  492.760957]   [<ffffffff810ecc54>] vfs_rmdir+0x79/0xd0
      [  492.766690]   [<ffffffff810eec4a>] do_rmdir+0xc2/0x111
      [  492.772423]   [<ffffffff810eecd0>] sys_rmdir+0x11/0x13
      [  492.778156]   [<ffffffff813ae4d2>] system_call_fastpath+0x16/0x1b
      [  492.784953]
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      140854cb
  6. 26 2月, 2012 15 次提交
  7. 07 2月, 2012 3 次提交
    • M
      target: Fix unsupported WRITE_SAME sense payload · 67236c44
      Martin Svec 提交于
      This patch fixes a bug in target-core where unsupported WRITE_SAME ops
      from a target_check_write_same_discard() failure was incorrectly
      returning CHECK_CONDITION w/ TCM_INVALID_CDB_FIELD sense data.
      This was causing some clients to not properly fall back, so go ahead
      and use the correct TCM_UNSUPPORTED_SCSI_OPCODE sense for this case.
      Reported-by: NMartin Svec <martin.svec@zoner.cz>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      67236c44
    • N
      target: Fix target_submit_cmd() exception handling · 735703ca
      Nicholas Bellinger 提交于
      This patch fixes a bug in target_submit_cmd() where the failure path
      for transport_generic_allocate_tasks() made a direct call to
      transport_send_check_condition_and_sense() and not calling the
      final target_put_sess_cmd() release callback.
      
      For transport_generic_allocate_tasks() failures, use the proper call to
      transport_generic_request_failure() to handle kref_put() along
      with potential internal queue full response processing.
      
      It also makes transport_lookup_cmd_lun() failures in
      target_submit_cmd() use transport_send_check_condition_and_sense() and
      target_put_sess_cmd() directly to avoid se_cmd->se_dev reference in
      transport_generic_request_failure() handling.
      
      Finally it drops the out_check_cond: label and use direct reference for
      allocate task failures, and per-se_device queue_full handling is
      currently not supported for transport_lookup_cmd_lun() failure
      descriptors due to se_device dependency.
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      735703ca
    • 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
  8. 18 1月, 2012 5 次提交
  9. 16 12月, 2011 1 次提交
    • R
      target: Set additional sense length field in sense data · 895f3022
      Roland Dreier 提交于
      The target code was not setting the additional sense length field in the
      sense data it returned, which meant that at least the Linux stack
      ignored the ASC/ASCQ fields.  For example, without this patch, on a
      tcm_loop device:
      
          # sg_raw -v /dev/sda 2 0 0 0 0 0
      
      gives
      
              cdb to send: 02 00 00 00 00 00
          SCSI Status: Check Condition
      
          Sense Information:
           Fixed format, current;  Sense key: Illegal Request
            Raw sense data (in hex):
                  70 00 05 00 00 00 00 00
      
      while after the patch we correctly get the following (which matches what
      a regular disk returns):
      
              cdb to send: 02 00 00 00 00 00
          SCSI Status: Check Condition
      
          Sense Information:
           Fixed format, current;  Sense key: Illegal Request
           Additional sense: Invalid command operation code
           Raw sense data (in hex):
                  70 00 05 00 00 00 00 0a  00 00 00 00 20 00 00 00
                  00 00
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      895f3022
  10. 14 12月, 2011 4 次提交
    • N
      target: Remove legacy device status check from transport_execute_tasks · 6d5b5975
      Nicholas Bellinger 提交于
      This patch removes a legacy se_dev_check_online() check from within
      transport_execute_tasks() that should no longer be necessary as
      transport_lookup_cmd_lun() is already making this call.
      
      Using transport_cmd_check_stop() from transport_execute_tasks() should
      already be checking per se_cmd context for each descriptor upon active
      I/O shutdown, so no need to acquire dev->dev_status_lock again while
      executing se_task submission.
      
      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>
      6d5b5975
    • N
      target: Remove __transport_execute_tasks() for each processing context · beb55a0c
      Nicholas Bellinger 提交于
      This patch removes the original usage of __transport_execute_tasks() ahead
      of every transport_get_cmd_from_queue() call in transport_processing_thread().
      This helps reduce se_device->execute_task_lock contention between qla2xxx wq
      with target_submit_cmd() for READs and transport_processing_thread()
      context servicing WRITEs with full payloads for I/O submission.
      
      It also adds a __transport_execute_tasks() to kick the task queue again
      without a *se_cmd descriptor with existing queue full logic, but this may
      end up not being necessary.
      
      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>
      beb55a0c
    • N
      target: Remove extra se_device->execute_task_lock access in fast path · 4d2300cc
      Nicholas Bellinger 提交于
      This patch makes __transport_execute_tasks() perform the addition of
      tasks to dev->execute_task_list via __transport_add_tasks_from_cmd()
      while holding dev->execute_task_lock during normal I/O fast path
      submission.
      
      It effectively removes the unnecessary re-acquire of dev->execute_task_lock
      during transport_execute_tasks() -> transport_add_tasks_from_cmd() ahead
      of calling  __transport_execute_tasks() to queue tasks for the passed
      *se_cmd descriptor.
      
      (v2: Re-add goto check_depth usage for multi-task submission for now..)
      
      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>
      4d2300cc
    • 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