1. 13 6月, 2012 5 次提交
    • R
      qla2xxx: Don't leak commands we give up on in qlt_do_work() · fae9eaf8
      Roland Dreier 提交于
      If we go to the "out_term:" exit path in qlt_do_work(), we call
      qlt_send_term_exchange() with a NULL cmd, which means that it can't
      possibly free the cmd for us.  Add an explicit call to free the
      command memory, so we don't leak the allocation.
      
      This will also fix warnings about "BUG qla_tgt_cmd_cachep: Objects
      remaining on kmem_cache_close" from slub when unloading the qla2xxx
      target module.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fae9eaf8
    • R
      qla2xxx: Don't crash if we can't find cmd for failed CTIO · 092e1dc3
      Roland Dreier 提交于
      In qlt_do_ctio_completion(), there's no point in calling
      qlt_term_ctio_exchange() with a NULL cmd -- all that it does is crash
      in a NULL pointer dereference, since it does
      
      	qlt_send_term_exchange(vha, cmd, &cmd->atio, 1);
      
      and dereferencing &cmd->atio is a bad idea if cmd itself is NULL.
      
      If we really need to do this, we could take the values from the
      failed CTIO we're processing, but it's not clear if it's worth
      the replumbing to do that.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      092e1dc3
    • 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
    • N
      tcm_qla2xxx: Clear session s_id + loop_id earlier during shutdown · f2d5d9b9
      Nicholas Bellinger 提交于
      This patch adds a new tcm_qla2xxx_clear_sess_lookup() call to clear session
      specific s_id + loop_id entries used for se_node_acl pointer lookup ahead
      of releasing se_session within the process context workqueue callback in
      tcm_qla2xxx_free_session().
      
      It makes the call in existing tcm_qla2xxx_clear_nacl_from_fcport_map()
      code invoked from qlt_unreg_sess() in interrupt context w/ hardware_lock
      held, ahead of the process context callback into qlt_free_session_done()
      -> tcm_qla2xxx_free_session().
      
      We are doing this to address a race between incoming ATIO or TMR packets
      using stale se_node_acl pointer once session shutdown has been invoked via
      qlt_unreg_sess() in qla_target.c LLD code, and when the entire tcm_qla2xxx
      endpoint has not been forced into shutdown w/ echo 0 > ../$QLA2XXX_PORT/enable
      
      Cc: Joern Engel <joern@logfs.org>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f2d5d9b9
    • J
      tcm_qla2xxx: Convert to TFO->put_session() usage · aaf68b75
      Joern Engel 提交于
      This patch converts tcm_qla2xxx code to use an internal kref_put() for
      se_session->sess_kref in order to ensure that qla_hw_data->hardware_lock
      can be held while calling qlt_unreg_sess() for the final put.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      aaf68b75
  2. 30 5月, 2012 9 次提交
  3. 23 5月, 2012 6 次提交
    • R
      [SCSI] fcoe, bnx2fc, libfcoe: SW FCoE and bnx2fc use FCoE Syfs · 8d55e507
      Robert Love 提交于
      This patch has the SW FCoE driver and the bnx2fc
      driver make use of the new fcoe_sysfs API added
      earlier in this patch series.
      
      After this patch a fcoe_ctlr_device is allocated with
      private data in this order.
      
      +------------------+   +------------------+
      | fcoe_ctlr_device |   | fcoe_ctlr_device |
      +------------------+   +------------------+
      | fcoe_ctlr        |   | fcoe_ctlr        |
      +------------------+   +------------------+
      | fcoe_interface   |   | bnx2fc_interface |
      +------------------+   +------------------+
      
      libfcoe also takes part in this new model since it
      discovers and manages fcoe_fcf instances. The memory
      allocation is different for FCFs. I didn't want to
      impact libfcoe's fcoe_fcf processing, so this patch
      creates fcoe_fcf_device instances for each discovered
      fcoe_fcf. The two are paired using a (void * priv)
      member of the fcoe_ctlr_device. This allows libfcoe
      to continue maintaining its list of fcoe_fcf instances
      and simply attaches and detaches them from existing
      or new fcoe_fcf_device instances.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      8d55e507
    • R
      [SCSI] libfcoe: Add fcoe_sysfs · 9a74e884
      Robert Love 提交于
      This patch adds a 'fcoe bus' infrastructure to the kernel
      that is driven by changes to libfcoe which allow LLDs to
      present FIP (FCoE Initialization Protocol) discovered
      entities and their attributes to user space via sysfs.
      
      This patch adds the following APIs-
      
      fcoe_ctlr_device_add
      fcoe_ctlr_device_delete
      fcoe_fcf_device_add
      fcoe_fcf_device_delete
      
      They allow the LLD to expose the FCoE ENode Controller
      and any discovered FCFs (Fibre Channel Forwarders, e.g.
      FCoE switches) to the user. Each of these new devices
      has their own bus_type so that they are grouped together
      for easy lookup from a user space application. Each
      new class has an attribute_group to expose attributes
      for any created instances. The attributes are-
      
      fcoe_ctlr_device
      * fcf_dev_loss_tmo
      * lesb_link_fail
      * lesb_vlink_fail
      * lesb_miss_fka
      * lesb_symb_err
      * lesb_err_block
      * lesb_fcs_error
      
      fcoe_fcf_device
      * fabric_name
      * switch_name
      * priority
      * selected
      * fc_map
      * vfid
      * mac
      * fka_peroid
      * fabric_state
      * dev_loss_tmo
      
      A device loss infrastructre similar to the FC Transport's
      is also added by this patch. It is nice to have so that a
      link flapping adapter doesn't continually advance the count
      used to identify the discovered FCF. FCFs will exist in a
      "Disconnected" state until either the timer expires or the
      FCF is rediscovered and becomes "Connected."
      
      This patch generates a few checkpatch.pl WARNINGS that
      I'm not sure what to do about. They're macros modeled
      around the FC Transport attribute building macros, which
      have the same 'feature' where the caller can ommit a cast
      in the argument list and no cast occurs in the code. I'm
      not sure how to keep the code condensed while keeping the
      macros. Any advice would be appreciated.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      9a74e884
    • R
      [SCSI] bnx2fc: Allocate fcoe_ctlr with bnx2fc_interface, not as a member · fd8f8902
      Robert Love 提交于
          Currently the fcoe_ctlr associated with an interface is allocated
          as a member of struct bnx2fc_interface. This causes problems when
          when later patches attempt to use the new fcoe_sysfs APIs which
          allow us to allocate the bnx2fc_interface as private data to a
          fcoe_ctlr_device instance. The problem is that libfcoe wants to
          be able use pointer math to find a fcoe_ctlr's fcoe_ctlr_device
          as well as finding a fcoe_ctlr_device's assocated fcoe_ctlr. To
          do this we need to allocate the fcoe_ctlr_device, with private
          data for the LLD. The private data will contain the fcoe_ctlr
          and its private data will be the bnx2fc_interface.
      
          +-------------------+
          | fcoe_ctlr_device  |
          +-------------------+
          | fcoe_ctlr         |
          +-------------------+
          | bnx2fc_interface  |
          +-------------------+
      
          This prep work will allow us to go from a fcoe_ctlr_device
          instance to its fcoe_ctlr as well as from a fcoe_ctlr to its
          fcoe_ctlr_device once the fcoe_sysfs API is in use (later
          patches in this series).
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      fd8f8902
    • R
      [SCSI] fcoe: Allocate fcoe_ctlr with fcoe_interface, not as a member · 619fe4be
      Robert Love 提交于
      Currently the fcoe_ctlr associated with an interface is allocated
      as a member of struct fcoe_interface. This causes problems when
      attempting to use the new fcoe_sysfs APIs which allow us to allocate
      the fcoe_interface as private data to the fcoe_ctlr_device instance.
      The problem is that libfcoe wants to be able use pointer math to find a
      fcoe_ctlr's fcoe_ctlr_device as well as finding a fcoe_ctlr_device's
      assocated fcoe_ctlr. To do this we need to allocate the
      fcoe_ctlr_device, with private data for the LLD. The private data
      contains the fcoe_ctlr and its private data is the fcoe_interface.
      This patch only allocates the fcoe_interface with the fcoe_ctlr, the
      fcoe_ctlr_device will be added in a later patch, which will complete
      the below diagram-
      
      +------------------+
      | fcoe_ctlr_device |
      +------------------+
      | fcoe_ctlr        |
      +------------------+
      | fcoe_interface   |
      +------------------+
      
      This prep work will allow us to go from a fcoe_ctlr_device instance
      to its fcoe_ctlr as well as from a fcoe_ctlr to its fcoe_ctlr_device
      once the fcoe_sysfs API is in use (later patches in this series).
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      619fe4be
    • J
      [SCSI] Fix dm-multipath starvation when scsi host is busy · b7e94a16
      Jun'ichi Nomura 提交于
      block congestion control doesn't have any concept of fairness across
      multiple queues.  This means that if SCSI reports the host as busy in
      the queue congestion control it can result in an unfair starvation
      situation in dm-mp if there are multiple multipath devices on the same
      host.  For example:
      http://www.redhat.com/archives/dm-devel/2012-May/msg00123.html
      
      The fix for this is to report only the sdev busy state (and ignore the
      host busy state) in the block congestion control call back.
      The host is still congested, but the SCSI subsystem will sort out the
      congestion in a fair way because it knows the relation between the
      queues and the host.
      
      [jejb: fixed up trailing whitespace]
      Reported-by: NBernd Schubert <bernd.schubert@itwm.fraunhofer.de>
      Tested-by: NBernd Schubert <bernd.schubert@itwm.fraunhofer.de>
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      b7e94a16
    • N
      [SCSI] ufs: fix potential NULL pointer dereferencing error in ufshcd_prove. · 4886b1af
      Namjae Jeon 提交于
      Avoid dereferencing a NULL pointer if scsi_host_alloc is failed.
      Signed-off-by: NNamjae Jeon <linkinjeon@gmail.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      4886b1af
  4. 22 5月, 2012 20 次提交