1. 18 1月, 2012 13 次提交
    • 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
  2. 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
  3. 14 12月, 2011 25 次提交
  4. 10 12月, 2011 1 次提交