1. 20 3月, 2015 1 次提交
    • B
      tcm_qla2xxx: Fix incorrect use of __transport_register_session · 75c3d0bf
      Bart Van Assche 提交于
      This patch fixes the incorrect use of __transport_register_session()
      in tcm_qla2xxx_check_initiator_node_acl() code, that does not perform
      explicit se_tpg->session_lock when accessing se_tpg->tpg_sess_list
      to add new se_sess nodes.
      
      Given that tcm_qla2xxx_check_initiator_node_acl() is not called with
      qla_hw->hardware_lock held for all accesses of ->tpg_sess_list, the
      code should be using transport_register_session() instead.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: <stable@vger.kernel.org> # 3.5+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      75c3d0bf
  2. 16 1月, 2015 1 次提交
  3. 04 10月, 2014 1 次提交
  4. 25 9月, 2014 3 次提交
  5. 04 6月, 2014 1 次提交
    • N
      qla2xxx: Convert to percpu_ida session tag pre-allocation · 51a07f84
      Nicholas Bellinger 提交于
      This patch converts qla2xxx target code to use generic percpu_ida
      tag allocation provided by target-core, thus removing the original
      kmem_cache_zalloc() for each struct qla_tgt_cmd descriptor in the
      incoming ATIO packet fast-path.
      
      This includes the conversion of qlt_handle_cmd_for_atio() to perform
      qla_tgt_sess lookup before dispatching a command descriptor into
      qla_tgt_wq process context, along with handling the case where no
      active session exists, and subsequently kicking off a seperate
      process context for qlt_create_sess_from_atio() to create a new one.
      
      It also includes moving tag allocation into generic code within
      qlt_get_tag(), so that the same logic can be shared between
      qlt_handle_cmd_for_atio() + qlt_create_sess_from_atio() contexts.
      Also, __qlt_do_work() has been made generic between both normal
      process context in qlt_do_work() + qlt_create_sess_from_atio().
      
      Next, update qlt_free_cmd() to release the percpu-ida tags, and
      drop the now-unused global qla_tgt_cmd_cachep.
      
      Finally in tcm_qla2xxx code, tcm_qla2xxx_check_initiator_node_acl()
      has been updated to use transport_init_session_tags() along with a
      hardcoded TCM_QLA2XXX_DEFAULT_TAGS=2088 as the number of qla_tgt_cmd
      descriptors to pre-allocate per qla_tgt_sess instance.
      
      (Use ha->fw_xcb_count if available to calculate num_tags, and
       also factor in extra pad tags - Quinn)
      
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      51a07f84
  6. 19 5月, 2014 1 次提交
  7. 07 4月, 2014 2 次提交
    • N
      target: Pass in transport supported PI at session initialization · e70beee7
      Nicholas Bellinger 提交于
      In order to support local WRITE_INSERT + READ_STRIP operations for
      non PI enabled fabrics, the fabric driver needs to be able signal
      what protection offload operations are supported.
      
      This is done at session initialization time so the modes can be
      signaled by individual se_wwn + se_portal_group endpoints, as well
      as optionally across different transports on the same endpoint.
      
      For iser-target, set TARGET_PROT_ALL if the underlying ib_device
      has already signaled PI offload support, and allow this to be
      exposed via a new iscsit_transport->iscsit_get_sup_prot_ops()
      callback.
      
      For loopback, set TARGET_PROT_ALL to signal SCSI initiator mode
      operation.
      
      For all other drivers, set TARGET_PROT_NORMAL to disable fabric
      level PI.
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e70beee7
    • 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
  8. 21 2月, 2014 3 次提交
    • N
      tcm_qla2xxx: Fix NAA formatted name for NPIV WWPNs · 84197a36
      Nicholas Bellinger 提交于
      This patch fixes the NAA formatted name used by EVPD=0x83
      device identifer to reflect the proper NPIV enabled WWPN.
      
      Cc: Sawan Chandak <sawan.chandak@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      84197a36
    • N
      tcm_qla2xxx: Perform configfs depend/undepend for base_tpg · 7474f52a
      Nicholas Bellinger 提交于
      This patch performs configfs_depend_item() during TPG enable for
      base_tpg (eg: non-NPIV) ports, and configfs_undepend_item() during
      TPG disable for base_tpg.
      
      This is done to ensure that any attempt to configfs rmdir a base_tpg
      with active NPIV ports will fail with -EBUSY, until all associated
      NPIV ports have been explicitly shutdown and base_tpg disabled.
      
      Note that the actual configfs_[un]depend_item() is done from seperate
      process context, as these are not intended to be called directly
      from configfs callbacks.
      
      Cc: Sawan Chandak <sawan.chandak@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7474f52a
    • N
      tcm_qla2xxx: Add NPIV specific enable/disable attribute logic · 394d62ba
      Nicholas Bellinger 提交于
      This patch adds seperate logic for NPIV specific enable/disable
      attribute logic, as NPIV vs. non-NPIV enable/disable ends up being
      different enough to warrent seperate logic for setting configfs
      tpg_group dependencies in the non-NPIV case.
      
      Cc: Sawan Chandak <sawan.chandak@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      394d62ba
  9. 19 1月, 2014 2 次提交
  10. 17 10月, 2013 2 次提交
  11. 11 9月, 2013 2 次提交
  12. 03 9月, 2013 1 次提交
  13. 13 8月, 2013 1 次提交
  14. 08 7月, 2013 1 次提交
  15. 21 6月, 2013 1 次提交
    • J
      qla_target: remove qlt_check_fcport_exist · 08234e3a
      Jörn Engel 提交于
      Comment from original 2012 patch:
        In all our testing this function has never returned true.  However, the
        dropping of hardware_lock necessary to call this function seems to cause
        a use-after-free we manage to hit rather frequently.  Given this
        cost-benefit ratio, I'm willing to remove some 100 lines of code.
      
      And since the same problem exists around shutdown_sess and put_sess,
      this patch changes them from taking the hardware_lock to requiring the
      hardware_lock to be taken.  In most cases the caller already had the
      lock and had to drop it for the called method to reacquire it.  At best
      that hurts performance and in rare instances it causes races with fatal
      consequences.
      
      We dropped the original 2012 patch when upgrading our kernel and it took
      us nearly half a year to discover we still need it.
      
      (nab: Fix qla_tgt_sess reference in tcm_qla2xxx_put_sess)
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      08234e3a
  16. 14 6月, 2013 1 次提交
    • R
      tcm_qla2xxx: Fix residual for underrun commands that fail · b5aff3d2
      Roland Dreier 提交于
      Suppose an initiator sends a DATA IN command with an allocation length
      shorter than the FC transfer length -- we get a target message like
      
          TARGET_CORE[qla2xxx]: Expected Transfer Length: 256 does not match SCSI CDB Length: 0 for SAM Opcode: 0x12
      
      In that case, the target core adjusts the data_length and sets
      se_cmd->residual_count for the underrun.  But now suppose that command
      fails and we end up in tcm_qla2xxx_queue_status() -- that function
      unconditionally overwrites residual_count with the already adjusted
      data_length, and the initiator will burp with a message like
      
          qla2xxx [0000:00:06.0]-301d:0: Dropped frame(s) detected (0x100 of 0x100 bytes).
      
      Fix this by adding on to the existing underflow residual count instead.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b5aff3d2
  17. 21 5月, 2013 1 次提交
  18. 07 11月, 2012 1 次提交
    • C
      target: pass sense_reason as a return value · de103c93
      Christoph Hellwig 提交于
      Pass the sense reason as an explicit return value from the I/O submission
      path instead of storing it in struct se_cmd and using negative return
      values.  This cleans up a lot of the code pathes, and with the sparse
      annotations for the new sense_reason_t type allows for much better
      error checking.
      
      (nab: Convert spc_emulate_modesense + spc_emulate_modeselect to use
            sense_reason_t with Roland's MODE SELECT changes)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      de103c93
  19. 30 10月, 2012 1 次提交
  20. 27 10月, 2012 2 次提交
    • R
      qla2xxx: Update target lookup session tables when a target session changes · c8292d1d
      Roland Dreier 提交于
      It is possible for the target code to change the loop_id or s_id of a
      target session in reaction to an FC fabric change.  However, the
      session structures are stored in tables that are indexed by these two
      keys, and if we just change the session structure but leave the
      pointers to it in the old places in the table, havoc can ensue.  For
      example, a new session might come along that should go in the old slot
      in the table and overwrite the old session pointer.
      
      To handle this, add a new tgt_ops->update_sess() method that also
      updates the "by loop_id" and "by s_id" lookup tables when a session
      changes, so that the keys where a session pointer is stored in these
      tables always matches the keys in the session structure itself.
      
      (nab: Drop unnecessary double inversion with FCF_CONF_COMP_SUPPORTED
            usage)
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c8292d1d
    • R
      tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC · c046aa0f
      Roland Dreier 提交于
      My draft of SPC-4 says the following about the SCSI name string in
      inquiry VPD page 83h:
      
          The SCSI NAME STRING field starts with either:
      
          a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
             32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
             and A through F) for an EUI-64 based identifier (see
             7.8.6.5). The first hexadecimal digit shall be the most
             significant four bits of the first byte (i.e., most significant
             byte) of the EUI-64 based identifier;
          b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
             hexadecimal digits for an NAA identifier (see 7.8.6.6). The
             first hexadecimal digit shall be the most significant four bits
             of the first byte (i.e., most significant byte) of the NAA
             identifier; or
          c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
             Name for an iSCSI-name based identifier (see iSCSI).
      
      However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
      the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
      This patch corrects the code so that VPD 83h gives a SPC-compliant
      SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
      other uses alone (so configfs will still work with ':' separated WWNs).
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c046aa0f
  21. 18 9月, 2012 2 次提交
  22. 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
  23. 17 7月, 2012 5 次提交
  24. 13 6月, 2012 3 次提交
    • R
      tcm_qla2xxx: Handle malformed wwn strings properly · d4f75b56
      Roland Dreier 提交于
      If we make a variable an unsigned int and then expect it to be < 0 on
      a bad character, we're going to have a bad time.  Fix the tcm_qla2xxx
      code to actually notice if hex_to_bin() returns a negative variable.
      
      This was detected by the compiler warning:
      
          scsi/qla2xxx/tcm_qla2xxx.c: In function ‘tcm_qla2xxx_npiv_extract_wwn’:
          scsi/qla2xxx/tcm_qla2xxx.c:148:3: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d4f75b56
    • R
    • R
      tcm_qla2xxx: Don't insert nacls without sessions into the btree · 3578ddba
      Roland Dreier 提交于
      When we create an explicit node ACL in tcm_qla2xxx_make_nodeacl(),
      there is a call to tcm_qla2xxx_setup_nacl_from_rport(), which puts the
      node ACL into the lport_fcport_map even though there is no session yet
      for the initiator.  Since the only time we remove entries from this
      map is when we free a session, this means that if we later delete this
      node ACL without the initiator ever creating a session, we'll leave
      the nacl pointer in the btree pointing at freed memory.
      
      This is especially bad if that initiator later does send us a command
      that would cause us to create a dynamic ACL and session: we'll find
      the stale freed nacl pointer in the btree and end up with use-after-free.
      
      We could add more code to clear the btree entry when deleting the
      explicit nacl, but the original insertion is pointless: without a
      session attached, we'll just have to update the entry when a session
      appears anyway.  So we can just delete tcm_qla2xxx_setup_nacl_from_rport()
      and the code that calls it.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3578ddba