1. 07 3月, 2009 3 次提交
    • C
      [SCSI] libfc: rport retry on LS_RJT from certain ELS · 6755db1c
      Chris Leech 提交于
      This allows any rport ELS to retry on LS_RJT.
      
      The rport error handling would only retry on resource allocation failures
      and exchange timeouts.  I have a target that will occasionally reject PLOGI
      when we do a quick LOGO/PLOGI.  When a critical ELS was rejected, libfc would
      fail silently leaving the rport in a dead state.
      
      The retry count and delay are managed by fc_rport_error_retry.  If the retry
      count is exceeded fc_rport_error will be called.  When retrying is not the
      correct course of action, fc_rport_error can be called directly.
      Signed-off-by: NChris Leech <christopher.leech@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      6755db1c
    • V
      [SCSI] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status · bc0e17f6
      Vasu Dev 提交于
      The fcoe_xmit could call fc_pause in case the pending skb queue len is larger
      than FCOE_MAX_QUEUE_DEPTH, the fc_pause was trying to grab lport->lp_muex to
      change lport->link_status and that had these issues :-
      
      1. The fcoe_xmit was getting called with bh disabled, thus causing
      "BUG: scheduling while atomic" when grabbing lport->lp_muex with bh disabled.
      
      2. fc_linkup and fc_linkdown function calls lport_enter function with
      lport->lp_mutex held and these enter function in turn calls fcoe_xmit to send
      lport related FC frame, e.g. fc_linkup => fc_lport_enter_flogi to send flogi
      req. In this case grabbing the same lport->lp_mutex again in fc_puase from
      fcoe_xmit would cause deadlock.
      
      The lport->lp_mutex was used for setting FC_PAUSE in fcoe_xmit path but
      FC_PAUSE bit was not used anywhere beside just setting and clear this
      bit in lport->link_status, instead used a separate field qfull in fc_lport
      to eliminate need for lport->lp_mutex to track pending queue full condition
      and in turn avoid above described two locking issues.
      
      Also added check for lp->qfull in fc_fcp_lport_queue_ready to trigger
      SCSI_MLQUEUE_HOST_BUSY when lp->qfull is set to prevent more scsi-ml cmds
      while lp->qfull is set.
      
      This patch eliminated FC_LINK_UP and FC_PAUSE and instead used dedicated
      fields in fc_lport for this, this simplified all related conditional
      code.
      
      Also removed fc_pause and fc_unpause functions and instead used newly added
      lport->qfull directly in fcoe.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      bc0e17f6
    • A
      [SCSI] libfc: Pass lport in exch_mgr_reset · 1f6ff364
      Abhijeet Joglekar 提交于
      fc_exch_mgr structure is private to fc_exch.c. To export exch_mgr_reset to
      transport, transport needs access to the exch manager. Change
      exch_mgr_reset to use lport param which is the shared structure between
      libFC and transport.
      
      Alternatively, fc_exch_mgr definition can be moved to libfc.h so that lport
      can be accessed from mp*.
      Signed-off-by: NAbhijeet Joglekar <abjoglek@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      1f6ff364
  2. 14 1月, 2009 1 次提交
  3. 06 1月, 2009 1 次提交
  4. 30 12月, 2008 11 次提交
  5. 21 11月, 2008 1 次提交
  6. 28 10月, 2008 1 次提交
  7. 21 10月, 2008 1 次提交
  8. 13 10月, 2008 8 次提交
    • M
      [SCSI] iscsi_tcp: return a descriptive error value during connection errors · 6f481e3c
      Mike Christie 提交于
      The segment->done functions return a iscsi error value which gives
      a lot more info than conn failed, so this patch has us return
      that value. I also add a new one for xmit failures.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      6f481e3c
    • M
      [SCSI] libiscsi: rename host reset to target reset · 8e124525
      Mike Christie 提交于
      I had this in my patchset to add target reset support, but
      it got dropped due to patching conflicts. This initial patch
      just renames the function and users. We are actually just
      dropping the session, and so this does not have anything to do
      with the host exactly. It does for software iscsi because
      we allocate a host per session, but for cxgb3i this makes no
      sense.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      8e124525
    • M
      [SCSI] iscsi class: fix endpoint id handling · 21536062
      Mike Christie 提交于
      Some endpoint code was using unsigned int and some
      was using uint64_t. This converts it all to uint64_t.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      21536062
    • M
      [SCSI] libiscsi: Support drivers initiating session removal · e5bd7b54
      Mike Christie 提交于
      If the driver knows when hardware is removed like with cxgb3i,
      bnx2i, qla4xxx and iser then we will want to remove the sessions/devices
      that are bound to that device before removing the host.
      
      cxgb3i and in the future bnx2i will remove the host and that will
      remove all the sessions on the hba. iser can call iscsi_kill_session
      when it gets an event that indicates that a hca is removed.
      And when qla4xxx is hooked in to the lib (it is only hooked into
      the class right now) it can call iscsi remove host like the
      partial offload card drivers.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      e5bd7b54
    • M
      [SCSI] fc class: Add support for new transport errors · f46e307d
      Mike Christie 提交于
      If the target is blocked and fast io fail tmo has not fired
      then we requeue with DID_TRANSPORT_DISRUPTED. Once that
      tmo fires we fail with DID_TRANSPORT_FAILFAST.
      
      v2
      - seperate from
      "fc class: unblock target after calling terminate callback"
      to make it easier to review.
      - Add JamesS's ack from list.
      v2
      - initial patch
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Acked-by: NJames Smart <James.Smart@emulex.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      f46e307d
    • M
      [SCSI] scsi: add transport host byte errors (v3) · a4dfaa6f
      Mike Christie 提交于
      Currently, if there is a transport problem the iscsi drivers will return
      outstanding commands (commands being exeucted by the driver/fw/hw) with
      DID_BUS_BUSY and block the session so no new commands can be queued.
      Commands that are caught between the failure handling and blocking are
      failed with DID_IMM_RETRY or one of the scsi ml queuecommand return values.
      When the recovery_timeout fires, the iscsi drivers then fail IO with
      DID_NO_CONNECT.
      
      For fcp, some drivers will fail some outstanding IO (disk but possibly not
      tape) with DID_BUS_BUSY or DID_ERROR or some other value that causes a retry
      and hits the scsi_error.c failfast check, block the rport, and commands
      caught in the race are failed with DID_IMM_RETRY. Other drivers, may
      hold onto all IO and wait for the terminate_rport_io or dev_loss_tmo_callbk
      to be called.
      
      The following patches attempt to unify what upper layers will see drivers
      like multipath can make a good guess. This relies on drivers being
      hooked into their transport class.
      
      This first patch just defines two new host byte errors so drivers can
      return the same value for when a rport/session is blocked and for
      when the fast_io_fail_tmo fires.
      
      The idea is that if the LLD/class detects a problem and is going to block
      a rport/session, then if the LLD wants or must return the command to scsi-ml,
      then it can return it with DID_TRANSPORT_DISRUPTED. This will requeue
      the IO into the same scsi queue it came from, until the fast io fail timer
      fires and the class decides what to do.
      
      When using multipath and the fast_io_fail_tmo fires then the class
      can fail commands with DID_TRANSPORT_FAILFAST or drivers can use
      DID_TRANSPORT_FAILFAST in their terminate_rport_io callbacks or
      the equivlent in iscsi if we ever implement more advanced recovery methods.
      A LLD, like lpfc, could continue to return DID_ERROR and then it will hit
      the normal failfast path, so drivers do not have fully be ported to
      work better. The point of the patches is that upper layers will
      not see a failure that could be recovered from while the rport/session is
      blocked until fast_io_fail_tmo/recovery_timeout fires.
      
      V3
      Remove some comments.
      V2
      Fixed patch/diff errors and renamed DID_TRANSPORT_BLOCKED to
      DID_TRANSPORT_DISRUPTED.
      V1
      initial patch.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      a4dfaa6f
    • M
      [SCSI] fc class: unblock target after calling terminate callback (take 2) · fff9d40c
      Mike Christie 提交于
      When we block a rport and the driver implements the terminate
      callback we will fail IO that was running quickly. However
      IO that was in the scsi_device/block queue sits there until
      the dev_loss_tmo fires, and this can make it look like IO is
      lost because new IO will get executed but that IO stuck in
      the blocked queue sits there for some time longer.
      
      With this patch when the fast io fail tmo fires, we will
      fail the blocked IO and any new IO. This patch also allows
      all drivers to partially support the fast io fail tmo. If the
      terminate io callback is not implemented, we will still fail blocked
      IO and any new IO, so multipath can handle that.
      
      This patch also allows the fc and iscsi classes to implement the
      same behavior. The timers are just unfornately named differently.
      
      This patch also fixes the problem where drivers were unblocking
      the target in their terminate callback, which was needed for
      rport removal, but for fast io fail timeout it would cause
      IO to bounce arround the scsi/block layer and the LLD queuecommand.
      And it for drivers that could have IO stuck but did not have
      a terminate callback the unblock calls in the class will fix
      them.
      
      v2.
      - fix up bit setting style to meet JamesS's pref.
      - Broke out new host byte error changes to make it easier to read.
      - added JamesS's ack from list.
      v1
      - initial patch
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Acked-by: NJames Smart <James.Smart@emulex.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      fff9d40c
    • M
      [SCSI] Add helper code so transport classes/driver can control queueing (v3) · f0c0a376
      Mike Christie 提交于
      SCSI-ml manages the queueing limits for the device and host, but
      does not do so at the target level. However something something similar
      can come in userful when a driver is transitioning a transport object to
      the the blocked state, becuase at that time we do not want to queue
      io and we do not want the queuecommand to be called again.
      
      The patch adds code similar to the exisiting SCSI_ML_*BUSY handlers.
      You can now return SCSI_MLQUEUE_TARGET_BUSY when we hit
      a transport level queueing issue like the hw cannot allocate some
      resource at the iscsi session/connection level, or the target has temporarily
      closed or shrunk the queueing window, or if we are transitioning
      to the blocked state.
      
      bnx2i, when they rework their firmware according to netdev
      developers requests, will also need to be able to limit queueing at this
      level. bnx2i will hook into libiscsi, but will allocate a scsi host per
      netdevice/hba, so unlike pure software iscsi/iser which is allocating
      a host per session, it cannot set the scsi_host->can_queue and return
      SCSI_MLQUEUE_HOST_BUSY to reflect queueing limits on the transport.
      
      The iscsi class/driver can also set a scsi_target->can_queue value which
      reflects the max commands the driver/class can support. For iscsi this
      reflects the number of commands we can support for each session due to
      session/connection hw limits, driver limits, and to also reflect the
      session/targets's queueing window.
      
      Changes:
      v1 - initial patch.
      v2 - Fix scsi_run_queue handling of multiple blocked targets.
      Previously we would break from the main loop if a device was added back on
      the starved list. We now run over the list and check if any target is
      blocked.
      v3 - Rediff for scsi-misc.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      f0c0a376
  9. 09 10月, 2008 1 次提交
  10. 04 10月, 2008 4 次提交
    • A
      [SCSI] fc_transport: Add an API to allow an LLD to create vports · a30c3f69
      Andrew Vasquez 提交于
      There's already a fc_vport_termintate() call exported by
      the transport.  This patch adds a symmetric call to the API to allow
      an NPIV-capable LLD to instantiate vports sans user intervention.
      
      Additional comments/updates:
      
         Re: scsi_fc_transport.txt
           Add a function prototype for fc_vport_terminate similar to what's
           done for fc_vport_create
      
         Re: fc_vport_create
           I recommend we pass the channel number in fc_vport_create rather
           than fixing it at zero.
      
           Also, ids->vport_type should be set to FC_PORTTYPE_NPIV prior to
           calling fc_vport_create. The comment is also meaningless.
      
      Added-by and
      Signed-off-by: NJames Smart <james.smart@emulex.com>
      Signed-off-by: NAndrew Vasquez <andrew.vasquez@qlogic.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      a30c3f69
    • J
      [SCSI] Update the SCSI state model to allow blocking in the created state · 6f4267e3
      James Bottomley 提交于
      Brian King <brking@linux.vnet.ibm.com> reported that fibre channel
      devices can oops during scanning if their ports block (because the
      device goes from CREATED -> BLOCK -> RUNNING rather than CREATED ->
      BLOCK -> CREATED).
      
      Fix this by adding a new state: CREATED_BLOCK which can only transition
      back to CREATED and disallow the CREATED -> BLOCK transition.  Now both
      the created and blocked states that the mid-layer recognises can include
      CREATED_BLOCK.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      6f4267e3
    • J
      [SCSI] add inline functions for recognising created and blocked states · 0f1d87a2
      James Bottomley 提交于
      The created and blocked states are very shortly going to correspond to
      mixed sdev_state states.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      0f1d87a2
    • J
      [SCSI] scsi_netlink: Add transport and LLD recieve and event support · 22447be7
      James Smart 提交于
      This patch adds scsi netlink recieve and event support for transport
      and scsi LLDD's.  It is a reimplementation of the patch posted last
      week by David Somayajulu.
      http://marc.info/?l=linux-scsi&m=121745486221819&w=2
      
      There are a few things done differently:
      
      - Transport support is included
      
      - Event delivery is included
      
      - The vendor message is now its own unique message type, considered
        part of the generic "SCSI Transport".
      
      - LLDD entry points are now registered rather than included in the
        scsi_host_template.
      
        Background: When I started to implement the event handler via template,
        I had to either: muck up scsi_add_host and scsi_remove_host;  or have
        the event handler search all possible shosts. Neither was acceptable.
        Moving to a registration solves this, and also limits the scope of
        the changes to something that could be backported to a distro without
        breaking an already-released-distro kabi. However, I admit it isn't
        as elegant, as the passing of the LLDD host template in the
        registration and the complexity around dynamic add/remove shows.
      
      - The receive path was augmented to require a unique identifier for
        the LLDD before the message was allowed to be handed off to the
        driver. Given how quickly very fatal errors occur if there's msg
        mismatches (which I saw in testing my own tools :), I believe this
        to be a very good thing. The id plays off the vendor id scheme already
        introduced for the vendor unique event messages used by FC.
        Additionally, the id use as the basis of the registration/deregistration.
      
      - Send assist functions, for both the transport and LLDDs are included.
      
      [fujita.tomonori@lab.ntt.co.jp: fix missing cast]
      Signed-off-by: NJames Smart <james.smart@emulex.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      22447be7
  11. 29 8月, 2008 1 次提交
  12. 07 8月, 2008 1 次提交
  13. 06 8月, 2008 1 次提交
  14. 05 8月, 2008 1 次提交
  15. 27 7月, 2008 4 次提交
    • A
      [SCSI] extend the last_sector_bug flag to cover more sectors · 2b142900
      Alan Jenkins 提交于
      The last_sector_bug flag was added to work around a bug in certain usb
      cardreaders, where they would crash if a multiple sector read included the
      last sector. The original implementation avoids this by e.g. splitting an 8
      sector read which includes the last sector into a 7 sector read, and a single
      sector read for the last sector.  The flag is enabled for all USB devices.
      
      This revealed a second bug in other usb cardreaders, which crash when they
      get a multiple sector read which stops 1 sector short of the last sector.
      Affected hardware includes the Kingston "MobileLite" external USB cardreader
      and the internal USB cardreader on the Asus EeePC.
      
      Extend the last_sector_bug workaround to ensure that any access which touches
      the last 8 hardware sectors of the device is a single sector long.  Requests
      are shrunk as necessary to meet this constraint.
      
      This gives us a safety margin against potential unknown or future bugs
      affecting multi-sector access to the end of the device.  The two known bugs
      only affect the last 2 sectors.  However, they suggest that these devices
      are prone to fencepost errors and that multi-sector access to the end of the
      device is not well tested.  Popular OS's use multi-sector accesses, but they
      rarely read the last few sectors.  Linux (with udev & vol_id) automatically
      reads sectors from the end of the device on insertion.  It is assumed that
      single sector accesses are more thoroughly tested during development.
      Signed-off-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Tested-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      2b142900
    • A
      [SCSI] scsi_eh_prep_cmnd should save scmd->underflow · 12265709
      Alan Stern 提交于
      This patch (as1116) fixes a bug in scsi_eh_prep_cmnd() and
      scsi_eh_restore_cmnd().  These routines are supposed to save any
      values they change and restore them later, but someone forgot to
      save & restore scmd->underflow.
      
      This fixes part of the problem reported in Bugzilla #9638.
      
      [jejb: fix up rejections around DIF/DIX]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      12265709
    • M
      [SCSI] Support devices with protection information · 7027ad72
      Martin K. Petersen 提交于
      Implement support for DMA of protection information for devices that
      are data integrity capable.
      
       - Add support for mapping an extra scatter-gather list containing
         the protection information.
      
       - Allocate protection scsi_data_buffer if host is DIX (integrity DMA)
         capable.
      
       - Accessor function for checking whether a device has protection
         enabled.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      7027ad72
    • M
      [SCSI] Command protection operation · db007fc5
      Martin K. Petersen 提交于
      Controllers that support DMA of protection information must be told
      explicitly how to handle the I/O.  The controller has no knowledge of
      the protection capabilities of the target device so this information
      must be passed in the scsi_cmnd.
      
       - The protection operation tells the HBA whether to generate, strip or
         verify protection information.
      
       - The protection type tells the HBA which layout the target is
         formatted with.  This is necessary because the controller must be
         able to correctly interpret the included protection information in
         order to verify it.
      
       - When a scsi_cmnd is reused for error handling the protection
         operation must be cleared and saved while error handling is in
         progress.
      
       - prot_op and prot_type are placed in an existing hole in scsi_cmnd
         and don't cause the structure to grow.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      db007fc5