1. 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
  2. 07 2月, 2012 9 次提交
  3. 18 1月, 2012 17 次提交
    • R
      target: Fail INQUIRY commands with EVPD==0 but PAGE CODE!=0 · bf005355
      Roland Dreier 提交于
      My draft of SPC-4 says:
      
          If the PAGE CODE field is not set to zero when the EVPD bit is set
          to zero, the command shall be terminated with CHECK CONDITION
          status, with the sense key set to ILLEGAL REQUEST, and the
          additional sense code set to INVALID FIELD IN CDB.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bf005355
    • R
      target: Return correct ASC for unimplemented VPD pages · bb1acb2e
      Roland Dreier 提交于
      My draft of SPC-4 says:
      
          If the device server does not implement the requested vital product
          data page, then the command shall be terminated with CHECK CONDITION
          status, with the sense key set to ILLEGAL REQUEST, and the
          additional sense code set to INVALID FIELD IN CDB.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bb1acb2e
    • N
      iscsi-target: Fix discovery with INADDR_ANY and IN6ADDR_ANY_INIT · 2f9bc894
      Nicholas Bellinger 提交于
      This patch addresses a bug with sendtargets discovery where INADDR_ANY (0.0.0.0)
      + IN6ADDR_ANY_INIT ([0:0:0:0:0:0:0:0]) network portals where incorrectly being
      reported back to initiators instead of the address of the connecting interface.
      To address this, save local socket ->getname() output during iscsi login setup,
      and makes iscsit_build_sendtargets_response() return these TargetAddress keys
      when INADDR_ANY or IN6ADDR_ANY_INIT portals are in use.
      Reported-by: NDax Kelson <dkelson@gurulabs.com>
      Reported-by: NAndy Grover <agrover@redhat.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2f9bc894
    • A
      target: Allow control CDBs with data > 1 page · 4949314c
      Andy Grover 提交于
      We need to handle >1 page control cdbs, so extend the code to do a vmap
      if bigger than 1 page. It seems like kmap() is still preferable if just
      a page, fewer TLB shootdowns(?), so keep using that when possible.
      
      Rename function pair for their new scope.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4949314c
    • J
      iscsi-target: Fix up a few assignments · e8904dc5
      Jesper Juhl 提交于
      A statement such as
        struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
      has undefined behaviour since there are two assignments to 'na', strictly
      speaking (the order in which side-effects from the assignments take place
      is undefined since there's no intervening sequence point), and it looks
      unintentional in any case.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e8904dc5
    • D
      iscsi-target: make one-bit bitfields unsigned · f8d48ae5
      Dan Carpenter 提交于
      Signed bitfields are a problem because instead of being 1 or 0 like
      you'd expect they are 0 and -1.  It doesn't cause a problem in this case
      but sparse complains:
      
      drivers/target/iscsi/iscsi_target_core.h:564:56: error: dubious one-bit
      signed bitfield
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f8d48ae5
    • N
      iscsi-target: Fix double list_add with iscsit_alloc_buffs reject · cd931ee6
      Nicholas Bellinger 提交于
      This patch fixes a bug where the iscsit_add_reject_from_cmd() call
      from a failure to iscsit_alloc_buffs() was incorrectly passing
      add_to_conn=1 and causing a double list_add after iscsi_cmd->i_list
      had already been added in iscsit_handle_scsi_cmd().
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      cd931ee6
    • N
      iscsi-target: Fix reject release handling in iscsit_free_cmd() · c1ce4bd5
      Nicholas Bellinger 提交于
      This patch addresses a bug where iscsit_free_cmd() was incorrectly calling
      iscsit_release_cmd() for ISCSI_OP_REJECT because iscsi_add_reject*() will
      overwrite the original iscsi_cmd->iscsi_opcode assignment.  This bug was
      introduced with the following commit:
      
      commit 0be67f2ed8f577d2c72d917928394c5885fa9134
      Author: Nicholas Bellinger <nab@linux-iscsi.org>
      Date:   Sun Oct 9 01:48:14 2011 -0700
      
          iscsi-target: Remove SCF_SE_LUN_CMD flag abuses
      
      and was manifesting itself as list corruption with the following:
      
      [  131.191092] ------------[ cut here ]------------
      [  131.191092] WARNING: at lib/list_debug.c:53 __list_del_entry+0x8d/0x98()
      [  131.191092] Hardware name: VMware Virtual Platform
      [  131.191092] list_del corruption. prev->next should be ffff880022d3c100, but was 6b6b6b6b6b6b6b6b
      [  131.191092] Modules linked in: tcm_vhost ib_srpt ib_cm ib_sa ib_mad ib_core tcm_qla2xxx qla2xxx tcm_loop tcm_fc libfc scsi_transport_fc crc32c iscsi_target_mod target_core_stgt scsi_tgt target_core_pscsi target_core_file target_core_iblock target_core_mod configfs ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi sr_mod cdrom sd_mod e1000 ata_piix libata mptspi mptscsih mptbase [last unloaded: scsi_wait_scan]
      [  131.191092] Pid: 2250, comm: iscsi_ttx Tainted: G        W    3.2.0-rc4+ #42
      [  131.191092] Call Trace:
      [  131.191092]  [<ffffffff8103b553>] warn_slowpath_common+0x80/0x98
      [  131.191092]  [<ffffffff8103b5ff>] warn_slowpath_fmt+0x41/0x43
      [  131.191092]  [<ffffffff811d0279>] __list_del_entry+0x8d/0x98
      [  131.191092]  [<ffffffffa01395c9>] transport_lun_remove_cmd+0x9b/0xb7 [target_core_mod]
      [  131.191092]  [<ffffffffa013a55c>] transport_generic_free_cmd+0x5d/0x71 [target_core_mod]
      [  131.191092]  [<ffffffffa01a012b>] iscsit_free_cmd+0x1e/0x27 [iscsi_target_mod]
      [  131.191092]  [<ffffffffa01a13be>] iscsit_close_connection+0x14d/0x5b2 [iscsi_target_mod]
      [  131.191092]  [<ffffffffa0196a0c>] iscsit_take_action_for_connection_exit+0xdb/0xe0 [iscsi_target_mod]
      [  131.191092]  [<ffffffffa01a55d4>] iscsi_target_tx_thread+0x15cb/0x1608 [iscsi_target_mod]
      [  131.191092]  [<ffffffff8103609a>] ? check_preempt_wakeup+0x121/0x185
      [  131.191092]  [<ffffffff81030801>] ? __dequeue_entity+0x2e/0x33
      [  131.191092]  [<ffffffffa01a4009>] ? iscsit_send_text_rsp+0x25f/0x25f [iscsi_target_mod]
      [  131.191092]  [<ffffffffa01a4009>] ? iscsit_send_text_rsp+0x25f/0x25f [iscsi_target_mod]
      [  131.191092]  [<ffffffff8138f706>] ? schedule+0x55/0x57
      [  131.191092]  [<ffffffff81056c7d>] kthread+0x7d/0x85
      [  131.191092]  [<ffffffff81399534>] kernel_thread_helper+0x4/0x10
      [  131.191092]  [<ffffffff81056c00>] ? kthread_worker_fn+0x16d/0x16d
      [  131.191092]  [<ffffffff81399530>] ? gs_change+0x13/0x13
      
      Reported-by: <jrepac@yahoo.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c1ce4bd5
    • S
      target: fix return code of core_tpg_.*_lun · 8d9efe53
      Sebastian Andrzej Siewior 提交于
      - core_tpg_pre_addlun()
        returns always ERR_PTR() or the pointer, never NULL. The additional
        check for NULL in core_dev_add_lun() is not required.
      
      - core_tpg_pre_dellun()
        returns always ERR_PTR() or the pointer, never NULL. The check for NULL
        in core_dev_del_lun() is wrong. The third argument (int *) is never
        used, remove it.
      
      - core_dev_add_lun()
        returns always NULL or the pointer, never ERR_PTR. The check for
        IS_ERR() is not required.
      
      (nab: Convert core_dev_add_lun() use err.h macros for failure
      handling to be consistent with the rest of target_core_fabric_configfs.c
      callers)
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8d9efe53
    • S
      target: use save/restore lock primitive in core_dec_lacl_count() · 1dd0a067
      Sebastian Andrzej Siewior 提交于
      It may happen that uasp will free the request in irq conntext, the
      callchain:
      
       uasp_cmd_release() -> transport_generic_free_cmd() -> core_dec_lacl_count()
      
      where the last function enables the IRQ. Those irqs are re-disabled
      later (due to the spin.*irq_restore) but in between we could get hurt.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1dd0a067
    • S
      target: avoid multiple outputs in scsi_dump_inquiry() · e59a41b6
      Sebastian Andrzej Siewior 提交于
      The multiple calls to pr_debug() each with one letter results in a new
      line. This patch merges the multiple requests into one call per line
      so we don't have the multiple line cuts.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e59a41b6
    • N
      target: Add workaround for zero-length control CDB handling · 91ec1d35
      Nicholas Bellinger 提交于
      This patch adds a work-around for handling zero allocation length
      control CDBs (type SCF_SCSI_CONTROL_SG_IO_CDB) that was causing an
      OOPs with the following raw calls:
      
         # sg_raw -v /dev/sdd 3 0 0 0 0 0
         # sg_raw -v /dev/sdd 0x1a 0 1 0 0 0
      
      This patch will follow existing zero-length handling for data I/O
      and silently return with GOOD status.  This addresses the zero length
      issue, but the proper long-term resolution for handling arbitary
      allocation lengths will be to refactor out data-phase handling in
      individual CDB emulation logic within target_core_cdb.c
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      91ec1d35
    • R
      target: Correct sense key for INVALID FIELD IN {PARAMETER LIST,CDB} · 9fbc8909
      Roland Dreier 提交于
      According to SPC-4, the sense key for commands that are failed with
      INVALID FIELD IN PARAMETER LIST and INVALID FIELD IN CDB should be
      ILLEGAL REQUEST (5h) rather than ABORTED COMMAND (Bh).  Without this
      patch, a tcm_loop LUN incorrectly gives:
      
          # sg_raw -r 1 -v /dev/sda 3 1 0 0 ff 0
          Sense Information:
           Fixed format, current;  Sense key: Aborted Command
           Additional sense: Invalid field in cdb
           Raw sense data (in hex):
                  70 00 0b 00 00 00 00 0a  00 00 00 00 24 00 00 00
                  00 00
      
      While a real SCSI disk gives:
      
          Sense Information:
           Fixed format, current;  Sense key: Illegal Request
           Additional sense: Invalid field in cdb
           Raw sense data (in hex):
                  70 00 05 00 00 00 00 18  00 00 00 00 24 00 00 00
                  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
      
      with the main point being that the real disk gives a sense key of
      ILLEGAL REQUEST (5h).
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9fbc8909
    • R
      target: Don't zero pages used for data buffers · 9db9da33
      roland@purestorage.com 提交于
      Doing alloc_page(GFP_KERNEL | __GFP_ZERO) to get pages used for data
      buffers wastes a lot of CPU clearing pages that will be quickly be
      overwritten by the actual data.  However, for emulated control
      commands such as INQUIRY and so on, the code does assume that the
      buffer is zeroed.
      
      To avoid this CPU overhead, skip the __GFP_ZERO for commands that are
      actually moving data, ie cmds that have SCF_SCSI_DATA_SG_IO_CDB set.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9db9da33
    • M
      target: Allow PERSISTENT RESERVE IN for non-reservation holder · 6816966a
      Marco Sanvido 提交于
      Initiators that aren't the active reservation holder should be able to
      do a PERSISTENT RESERVE IN command in all cases, so add it to the list
      of allowed CDBs in core_scsi3_pr_seq_non_holder().
      Signed-off-by: NMarco Sanvido <marco@purestorage.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6816966a
    • M
      target: Use correct preempted registration sense code · 9e08e34e
      Marco Sanvido 提交于
      The comments quote the right parts of the spec:
      
         * d) Establish a unit attention condition for the
         *    initiator port associated with every I_T nexus
         *    that lost its registration other than the I_T
         *    nexus on which the PERSISTENT RESERVE OUT command
         *    was received, with the additional sense code set
         *    to REGISTRATIONS PREEMPTED.
      
      and
      
         * e) Establish a unit attention condition for the initiator
         *    port associated with every I_T nexus that lost its
         *    persistent reservation and/or registration, with the
         *    additional sense code set to REGISTRATIONS PREEMPTED;
      
      but the actual code accidentally uses ASCQ_2AH_RESERVATIONS_PREEMPTED
      instead of ASCQ_2AH_REGISTRATIONS_PREEMPTED.  Fix this.
      Signed-off-by: NMarco Sanvido <marco@purestorage.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9e08e34e
    • C
      target: don't allocate bio headroom in iblock · 48cfe37c
      Christoph Hellwig 提交于
      We never embedd the bio into a structure, so there is no need to allocate
      64 bytes of headroom per bio.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      48cfe37c
  4. 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
  5. 14 12月, 2011 12 次提交
    • 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
    • N
      target: Fix possible NULL pointer with __transport_execute_tasks · 40be67f4
      Nicholas Bellinger 提交于
      This patch makes __transport_execute_tasks() use a local *se_dev
      reference to prevent direct se_cmd->se_dev access after
      transport_cmd_check_stop() -> transport_add_tasks_from_cmd()
      has been called, as in the current implementation we can expect
      __transport_execute_tasks() may be called from another context
      that may have already completed the I/O.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      40be67f4
    • N
      target: Remove TFO->check_release_cmd() fabric API caller · ec54cc08
      Nicholas Bellinger 提交于
      Remove the now unused target_core_fabric_ops->check_release_cmd() as
      target_core handles this directly for se_cmd->cmd_kref objects now.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ec54cc08
    • 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
    • N
      target: Add target_submit_cmd() for process context fabric submission · a6360785
      Nicholas Bellinger 提交于
      This patch adds a target_submit_cmd() caller that can be used by fabrics
      to submit an uninitialized se_cmd descriptor to an struct se_session +
      unpacked_lun from workqueue process context.  This call will invoke the
      following steps:
      
      - transport_init_se_cmd() to setup se_cmd specific pointers
      - Obtain se_cmd->cmd_kref references with target_get_sess_cmd()
      - set se_cmd->t_tasks_bidi
      - transport_lookup_cmd_lun() to setup struct se_cmd->se_lun from
        the passed unpacked_lun
      - transport_generic_allocate_tasks() to setup the passed *cdb, and
      - transport_handle_cdb_direct() handle READ dispatch or WRITE
        ready-to-transfer callback to fabric
      
      v2 changes from hch feedback:
      
      *) Add target_sc_flags_table for target_submit_cmd flags
      *) Rename bidi parameter to flags, add TARGET_SCF_BIDI_OP
      *) Convert checks to BUG_ON
      *) Add out_check_cond for transport_send_check_condition_and_sense
         usage
      
      v3 changes:
      
      *) Add TARGET_SCF_ACK_KREF for target_submit_cmd into
         target_get_sess_cmd to determine when the fabric caller is expecting
         a second kref_put() from fabric packet acknowledgement.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a6360785
    • N
      target: Make target_put_sess_cmd use target_release_cmd_kref · 7481deb4
      Nicholas Bellinger 提交于
      This patch moves target_put_sess_cmd() to use a se_cmd->cmd_kref
      callback target_release_cmd_kref when performing driver release of
      fabric->se_cmd descriptor memory.  It sets the default cmd_kref
      count value to '2' within target_get_sess_cmd() setup, and
      currently assumes TFO->check_stop_free() usage.
      
      It drops se_tfo->check_release_cmd() usage in the main
      transport_release_cmd codepath.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7481deb4
    • R
      target: Set response format in INQUIRY response · ce136176
      Roland Dreier 提交于
      Current SCSI specs say that the "response format" field in the standard
      INQUIRY response should be set to 2, and all the real SCSI devices I
      have do put 2 here.  So let's do that too.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ce136176
    • S
      target: tcm_mod_builder: small fixups · ced38c8c
      Sebastian Andrzej Siewior 提交于
      This includes:
      - remove on _ in "__NAMELEN" in $fabric _make_tport
      - target_fabric_configfs_init() returns an error pointer and not NULL
        anymore. Consider that.
      - replace (!(var_name)) with (!var_name). The extra () are not required
      - remove #ifdef MODULE. If the code is builtin it needs an init function
        or the code is useless
      - put exit/clean functions into __exit
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ced38c8c
    • N
      Documentation/target: Fix tcm_mod_builder.py build breakage · 77271de6
      Nicholas Bellinger 提交于
      This patch fixes TFO->release_cmd() and removes legacy pack_lun() usage
      and new_cmd_failure when generating new TCM fabric skeleton from the
      tcm_mod_builder.py script.
      Reported-by: NStefan Bergstrand <stefan.bergstrand@sdsab.se>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      77271de6