1. 27 4月, 2009 1 次提交
  2. 03 4月, 2009 1 次提交
    • J
      [SCSI] fix recovered error handling · a9bddd74
      James Bottomley 提交于
      We have a problem with recovered error handling in that any command
      which goes down as BLOCK_PC but which returns a sense code of RECOVERED
      ERROR gets completed with -EIO.  For actual SG_IO commands, this doesn't
      matter at all, since the error return code gets dropped in favour of
      req->errors which contain the SCSI completion code.
      
      However, if this command is part of the block system, then it will pay
      attention to the returned error code.  In particularly if a SYNCHRONIZE
      CACHE from a barrier command completes with RECOVERED ERROR, the
      resulting -EIO on the barrier causes block to error the request and
      return it to the filesystem.  Fix this by converting the -EIO for
      recovered error to zero, plus remove the printing of this from sd and sr
      so the message isn't double printed.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      a9bddd74
  3. 13 3月, 2009 1 次提交
  4. 22 2月, 2009 1 次提交
  5. 08 1月, 2009 1 次提交
    • J
      [SCSI] scsi_lib: fix DID_RESET status problems · 79ed2429
      James Bottomley 提交于
      Andrew Vaszquez said:
      > There's a problem that is causing commands returned by the LLD with
      > a DID_RESET status to be reissued with cleared cmd->sdb data which
      > in our tests are manifesting in firmware detected overruns.  Here's
      > a snippet of a READ_10 scsi_cmnd upon completion by the storage
      
      The problem is caused by:
      
      commit b60af5b0
      Author: Alan Stern <stern@rowland.harvard.edu>
      Date:   Mon Nov 3 15:56:47 2008 -0500
      
          [SCSI] simplify scsi_io_completion()
      
      Because scsi_release_buffers() is called before commands that go
      through the ACTION_RETRY and ACTION_DELAYED_RETRY legs are requeued.
      However, they're not re-prepared, so nothing ever reallocates the
      buffer resources to them.  Fix this by releasing the buffers only if
      we're not going to go down these legs (but scsi_release_buffers() on
      all legs including two in scsi_end_request(); this latter needs a
      special version __scsi_release_buffers() because the final one can be
      called after the request has been freed, so the bidi test in
      scsi_release_buffers(), which touches the request has to be skipped).
      Reported-by: NAndrew Vasquez <andrew.vasquez@qlogic.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      79ed2429
  6. 05 1月, 2009 2 次提交
    • M
      [SCSI] Fix error handling for DIF/DIX · 3e695f89
      Martin K. Petersen 提交于
      patch
      
      commit b60af5b0
      Author: Alan Stern <stern@rowland.harvard.edu>
      Date:   Mon Nov 3 15:56:47 2008 -0500
      
          [SCSI] simplify scsi_io_completion()
      
      broke DIX error handling.  Also, we are now using EILSEQ to indicate
      integrity errors to the upper layers (as opposed to regular EIO
      failures).  This allows filesystems to inspect buffers and decide
      whether to retry the I/O.  Update scsi_io_completion() accordingly.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      3e695f89
    • J
      [SCSI] scsi_lib: don't decrement busy counters when inserting commands · 4f5299ac
      James Bottomley 提交于
      A bug was introduced by
      
      commit b60af5b0
      Author: Alan Stern <stern@rowland.harvard.edu>
      Date:   Mon Nov 3 15:56:47 2008 -0500
      
          [SCSI] simplify scsi_io_completion()
       
      because the simplification uses scsi_queue_insert().  The problem with
      this function is that it expects to be called from the completion path
      while the command is still outstanding, so it decrements the device
      and host busy counts to do the requeue.  The problem is that
      scsi_io_completion() is a path executed well after these counts have
      *already* been decremented, leading to a double decrement if the
      command goes down any error path leading to ACTION_DELAYED_RETRY.
      
      The fix is to allow a private function __scsi_queue_insert() with a
      flag to say whether the busy counters should be decremented.  This is
      made static to scsi_lib.c to discourage other use.
      Reported-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      4f5299ac
  7. 03 1月, 2009 1 次提交
  8. 30 12月, 2008 2 次提交
    • F
      [SCSI] add residual argument to scsi_execute and scsi_execute_req · f4f4e47e
      FUJITA Tomonori 提交于
      scsi_execute() and scsi_execute_req() discard the residual length
      information. Some callers need it. This adds residual argument
      (optional) to scsi_execute and scsi_execute_req.
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      f4f4e47e
    • A
      [SCSI] simplify scsi_io_completion() · b60af5b0
      Alan Stern 提交于
      This patch (as1142b) consolidates a lot of repetitious code in
      scsi_io_completion().  It also fixes a few comments.  Most
      importantly, however, it clearly distinguishes among the three sorts
      of retries that can be done when a command fails to complete:
      
      	Unprepare the request and resubmit it, so that a new
      	command will be created for it.
      
      	Requeue the request directly so that it will be retried
      	immediately using the same command.
      
      	Requeue the request so that it will be retried following
      	a short delay.
      
      	Complete the remainder of the request with an I/O error.
      
      [jejb: Updates
           1. For several error conditions, we would now print the sense twice
              in slightly different ways, so unify the location of sense
              printing.
           2. I added more descriptions to actual failure conditions for
              better debugging
           3. according to spec, ABORTED_COMMAND is supposed to be retried
              (except on DIF failure).  Our old behaviour of erroring it looks
              to be a bug.
           4. I'd prefer not to default initialise the action variable because
              that ensures that every leg of the error handler has an
              associated action and the compiler will warn if someone later
              accidentally misses one or removes one.
      ]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      b60af5b0
  9. 14 12月, 2008 1 次提交
  10. 16 11月, 2008 1 次提交
  11. 24 10月, 2008 3 次提交
  12. 13 10月, 2008 2 次提交
    • M
      [SCSI] modify scsi to handle new fail fast flags. · 4a27446f
      Mike Christie 提交于
      This checks the errors the scsi-ml determined were retryable
      and returns if we should fast fail it based on the request
      fail fast flags.
      
      Without the patch, drivers like lpfc, qla2xxx and fcoe would return
      DID_ERROR for what it determines is a temporary communication problem.
      There is no loss of connectivity at that time and the driver thinks
      that it would be fast to retry at the driver level. SCSI-ml will however
      sees fast fail on the request and DID_ERROR and will fast fail the io.
      This will then cause dm-multipath to fail the path and possibley switch
      target controllers when we should be retrying at the scsi layer.
      
      We also were fast failing device errors to dm multiapth when
      unless the scsi_dh modules think otherwis we want to retry at
      the scsi layer because multipath can only retry the IO like scsi
      should have done. multipath is a little dumber though because it
      does not what the error was for and assumes that it should fail
      the paths.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      4a27446f
    • 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
  13. 09 10月, 2008 1 次提交
  14. 04 10月, 2008 1 次提交
  15. 24 9月, 2008 1 次提交
    • J
      [SCSI] Fix hang with split requests · 44ea91c5
      James Bottomley 提交于
      Sometimes, particularly for USB devices with the last sector bug,
      requests get completed in chunks.  There's a bug in this in that if
      one of the chunks gets an error, we complete that chunk with an error
      but never move on to the remaining ones, leading to the request
      hanging (because it's not fully completed).
      
      Fix this by completing all remaining chunks if an error is encountered.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      44ea91c5
  16. 27 7月, 2008 5 次提交
  17. 12 7月, 2008 2 次提交
  18. 07 7月, 2008 1 次提交
  19. 05 6月, 2008 1 次提交
  20. 03 5月, 2008 1 次提交
  21. 02 5月, 2008 1 次提交
    • B
      [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer · 64a87b24
      Boaz Harrosh 提交于
       - struct scsi_cmnd had a 16 bytes command buffer of its own.
         This is an unnecessary duplication and copy of request's
         cmd. It is probably left overs from the time that scsi_cmnd
         could function without a request attached. So clean that up.
      
       - Once above is done, few places, apart from scsi-ml, needed
         adjustments due to changing the data type of scsi_cmnd->cmnd.
      
       - Lots of drivers still use MAX_COMMAND_SIZE. So I have left
         that #define but equate it to BLK_MAX_CDB. The way I see it
         and is reflected in the patch below is.
         MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB
                            as per the SCSI standard and is not related
                            to the implementation.
         BLK_MAX_CDB.     - The allocated space at the request level
      
       - I have audit all ISA drivers and made sure none use ->cmnd in a DMA
         Operation. Same audit was done by Andi Kleen.
      
      (*)fixed-length here means commands that their size can be determined
         by their opcode and the CDB does not carry a length specifier, (unlike
         the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
         true and the SCSI standard also defines extended commands and
         vendor specific commands that can be bigger than 16 bytes. The kernel
         will support these using the same infrastructure used for VARLEN CDB's.
         So in effect MAX_COMMAND_SIZE means the maximum size command
         scsi-ml supports without specifying a cmd_len by ULD's
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      64a87b24
  22. 29 4月, 2008 1 次提交
  23. 08 4月, 2008 2 次提交
  24. 20 3月, 2008 1 次提交
    • K
      [SCSI] fix media change events for polled devices · 4d1566ed
      Kay Sievers 提交于
      Commit:
        a341cd0f (SCSI: add asynchronous event notification API)
      breaks:
        285e9670 (sr,sd: send media state change modification events)
      by introducing an event filter, which is removed here, to make
      events, we are depending on, happen again.
      
      Fix this by removing the event filter.  It's pretty much broken at the
      moment, since a user can't set it (the attribute being read only).  A
      proper fix will be to make the event discriminator distinguish between
      AN and Polled media change events.
      
      Cc: David Zeuthen <david@fubar.dk>
      Cc: kristen accardi <kaccardi@gmail.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      4d1566ed
  25. 19 2月, 2008 1 次提交
    • T
      block: add request->raw_data_len · 6b00769f
      Tejun Heo 提交于
      With padding and draining moved into it, block layer now may extend
      requests as directed by queue parameters, so now a request has two
      sizes - the original request size and the extended size which matches
      the size of area pointed to by bios and later by sgs.  The latter size
      is what lower layers are primarily interested in when allocating,
      filling up DMA tables and setting up the controller.
      
      Both padding and draining extend the data area to accomodate
      controller characteristics.  As any controller which speaks SCSI can
      handle underflows, feeding larger data area is safe.
      
      So, this patch makes the primary data length field, request->data_len,
      indicate the size of full data area and add a separate length field,
      request->raw_data_len, for the unmodified request size.  The latter is
      used to report to higher layer (userland) and where the original
      request size should be fed to the controller or device.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      6b00769f
  26. 08 2月, 2008 1 次提交
    • T
      [SCSI] fix BUG when sum(scatterlist) > bufflen · 4d2de3a5
      Tony Battersby 提交于
      When sending a SCSI command to a tape drive via the SCSI Generic (sg)
      driver, if the command has a data transfer length more than
      scatter_elem_sz (32 KB default) and not a multiple of 512, then I either
      hit BUG_ON(!valid_dma_direction(direction)) in dma_unmap_sg() or else
      the command never completes (depending on the LLDD).
      
      When constructing scatterlists, the sg driver rounds up the scatterlist
      element sizes to be a multiple of 512.  This can result in
      sum(scatterlist lengths) > bufflen.  In this case, scsi_req_map_sg()
      incorrectly sets bio->bi_size to sum(scatterlist lengths) rather than to
      bufflen.  When the command completes, req_bio_endio() detects that
      bio->bi_size != 0, and so it doesn't call bio_endio().  This causes the
      command to be resubmitted, resulting in BUG_ON or the command never
      completing.
      
      This patch makes scsi_req_map_sg() set bio->bi_size to bufflen rather
      than to sum(scatterlist lengths), which fixes the problem.
      Signed-off-by: NTony Battersby <tonyb@cybernetics.com>
      Acked-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      4d2de3a5
  27. 06 2月, 2008 2 次提交
  28. 31 1月, 2008 1 次提交