1. 14 1月, 2011 1 次提交
    • T
      [SCSI] sd: implement sd_check_events() · 2bae0093
      Tejun Heo 提交于
      Replace sd_media_change() with sd_check_events().
      
      * Move media removed logic into set_media_not_present() and
        media_not_present() and set sdev->changed iff an existing media is
        removed or the device indicates UNIT_ATTENTION.
      
      * Make sd_check_events() sets sdev->changed if previously missing
        media becomes present.
      
      * Event is reported only if sdev->changed is set.
      
      This makes media presence event reported if scsi_disk->media_present
      actually changed or the device indicated UNIT_ATTENTION.  For backward
      compatibility, SDEV_EVT_MEDIA_CHANGE is generated each time
      sd_check_events() detects media change event.
      
      [jejb: fix boot failure]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      2bae0093
  2. 22 12月, 2010 1 次提交
  3. 17 12月, 2010 1 次提交
    • T
      sd: implement sd_check_events() · c8d2e937
      Tejun Heo 提交于
      Replace sd_media_change() with sd_check_events().  sd used to set the
      changed state whenever the device is not ready, which can cause event
      loop while the device is not ready.  Media presence handling code is
      changed such that the changed state is set iff the media presence
      actually changes.  UA still always sets the changed state and
      NOT_READY always (at least where it used to set ->changed) clears
      media presence, so no event is lost.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      c8d2e937
  4. 12 10月, 2010 1 次提交
  5. 18 9月, 2010 1 次提交
  6. 06 9月, 2010 1 次提交
  7. 08 8月, 2010 1 次提交
    • A
      scsi/sd: remove big kernel lock · 409f3499
      Arnd Bergmann 提交于
      Every user of the BKL in the sd driver is the
      result of the pushdown from the block layer
      into the open/close/ioctl functions.
      
      The only place that used to rely on the BKL is
      the sdkp->openers variable, which gets converted
      into an atomic_t.
      
      Nothing else seems to rely on the BKL, since the
      functions do not touch global data without holding
      another lock, and the open/close functions are
      still protected from concurrent execution using
      the bdev->bd_mutex.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: linux-scsi@vger.kernel.org
      Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
      Acked-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      409f3499
  8. 10 12月, 2009 1 次提交
  9. 02 10月, 2009 2 次提交
  10. 21 6月, 2009 1 次提交
  11. 18 3月, 2009 1 次提交
  12. 15 10月, 2008 1 次提交
  13. 13 10月, 2008 1 次提交
  14. 06 8月, 2008 1 次提交
  15. 05 8月, 2008 1 次提交
  16. 27 7月, 2008 3 次提交
    • 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
    • M
      [SCSI] sd: Support for SCSI disk (SBC) Data Integrity Field · af55ff67
      Martin K. Petersen 提交于
      Support for controllers and disks that implement DIF protection
      information:
      
       - During command preparation the RDPROTECT/WRPROTECT must be set
         correctly if the target has DIF enabled.
      
       - READ(6) and WRITE(6) are not supported when DIF is on.
      
       - The controller must be told how to handle the I/O via the
         protection operation field in scsi_cmnd.
      
       - Refactor the I/O completion code that extracts failed LBA from the
         returned sense data and handle DIF failures correctly.
      
       - sd_dif.c implements the functions required to prepare and complete
         requests with protection information attached.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      af55ff67
    • M
      [SCSI] sd: Identify DIF protection type and application tag ownership · e0597d70
      Martin K. Petersen 提交于
      If a disk is formatted with protection information (Inquiry bit
      PROTECT=1) it is required to support Read Capacity(16).  Force use of
      the 16-bit command in this case and extract the P_TYPE field which
      indicates whether the disk is formatted using DIF Type 1, 2 or 3.
      
      The ATO (App Tag Own) bit in the Control Mode Page indicates whether
      the storage device or the initiator own the contents of the
      DIF application tag.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      e0597d70
  17. 12 7月, 2008 2 次提交
  18. 20 4月, 2008 1 次提交
  19. 12 1月, 2008 1 次提交
    • K
      [SCSI] sr,sd: send media state change modification events · 285e9670
      Kay Sievers 提交于
      This will send for a card reader slot (remove/add media):
        UEVENT[1187091572.155884] change   /devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 (scsi)
        UEVENT[1187091572.162314] remove   /block/sdb/sdb1 (block)
        UEVENT[1187091572.172464] add      /block/sdb/sdb1 (block)
        UEVENT[1187091572.175408] change   /devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 (scsi)
      
      and for a DVD drive (add/eject media):
        UEVENT[1187091590.189159] change   /devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)
        UEVENT[1187091590.957124] add      /module/isofs (module)
        UEVENT[1187091604.468207] change   /devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)
      
      Userspace gets events, even for unpartitioned media. This unifies
      the event handling for asynchronoous events (AN) and events caused by
      perodical polling the device from userspace.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      
      [jejb: modified for new event API]
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      285e9670
  20. 07 1月, 2008 1 次提交
    • L
      Revert "scsi: revert "[SCSI] Get rid of scsi_cmnd->done"" · 7b3d9545
      Linus Torvalds 提交于
      This reverts commit ac40532e, which gets
      us back the original cleanup of 6f5391c2.
      
      It turns out that the bug that was triggered by that commit was
      apparently not actually triggered by that commit at all, and just the
      testing conditions had changed enough to make it appear to be due to it.
      
      The real problem seems to have been found by Peter Osterlund:
      
        "pktcdvd sets it [block device size] when opening the /dev/pktcdvd
         device, but when the drive is later opened as /dev/scd0, there is
         nothing that sets it back.  (Btw, 40944 is possible if the disk is a
         CDRW that was formatted with "cdrwtool -m 10236".)
      
         The problem is that pktcdvd opens the cd device in non-blocking mode
         when pktsetup is run, and doesn't close it again until pktsetup -d is
         run.  The effect is that if you meanwhile open the cd device,
         blkdev.c:do_open() doesn't call bd_set_size() because
         bdev->bd_openers is non-zero."
      
      In particular, to repeat the bug (regardless of whether commit
      6f5391c2 is applied or not):
      
        " 1. Start with an empty drive.
          2. pktsetup 0 /dev/scd0
          3. Insert a CD containing an isofs filesystem.
          4. mount /dev/pktcdvd/0 /mnt/tmp
          5. umount /mnt/tmp
          6. Press the eject button.
          7. Insert a DVD containing a non-writable filesystem.
          8. mount /dev/scd0 /mnt/tmp
          9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
          10. If the DVD contains data beyond the physical size of a CD, you
              get I/O errors in the terminal, and dmesg reports lots of
              "attempt to access beyond end of device" errors."
      
      which in turn is because the nested open after the media change won't
      cause the size to be set properly (because the original open still holds
      the block device, and we only do the bd_set_size() when we don't have
      other people holding the device open).
      
      The proper fix for that is probably to just do something like
      
      	bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<<9;
      
      in fs/block_dev.c:do_open() even for the cases where we're not the
      original opener (but *not* call bd_set_size(), since that will also
      change the block size of the device).
      
      Cc: Peter Osterlund <petero2@telia.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7b3d9545
  21. 03 1月, 2008 1 次提交
  22. 13 10月, 2007 2 次提交
    • M
      [SCSI] Get rid of scsi_cmnd->done · 6f5391c2
      Matthew Wilcox 提交于
      The ULD ->done callback moves into the scsi_driver.  By moving the call
      to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(),
      we can eliminate the latter entirely.  By returning 'good_bytes' from
      the ->done callback (rather than invoking scsi_io_completion()), we can
      stop exporting scsi_io_completion().
      
      Also move the prototypes from sd.h to sd.c as they're all internal anyway.
      Rename sd_rw_intr to sd_done and rw_intr to sr_done.
      Inspired-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      6f5391c2
    • J
      [SCSI] move ULD attachment into the prep function · 7f9a6bc4
      James Bottomley 提交于
      One of the intents of the block prep function was to allow ULDs to use
      it for preprocessing.  The original SCSI model was to have a single prep
      function and add a pointer indirect filter to build the necessary
      commands.  This patch reverses that, does away with the init_command
      field of the scsi_driver structure and makes ULDs attach directly to the
      prep function instead.  The value is really that it allows us to begin
      to separate the ULDs from the SCSI mid layer (as long as they don't use
      any core functions---which is hard at the moment---a ULD doesn't even
      need SCSI to bind).
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      7f9a6bc4
  23. 04 8月, 2007 1 次提交
  24. 24 7月, 2007 1 次提交
  25. 21 3月, 2007 1 次提交
    • T
      [SCSI] sd: implement START/STOP management · c3c94c5a
      Tejun Heo 提交于
      Implement SBC START/STOP management.  sdev->mange_start_stop is added.
      When it's set to one, sd STOPs the device on suspend and shutdown and
      STARTs it on resume.  sdev->manage_start_stop defaults is in sdev
      instead of scsi_disk cdev to allow ->slave_config() override the
      default configuration but is exported under scsi_disk sysfs node as
      sdev->allow_restart is.
      
      When manage_start_stop is zero (the default value), this patch doesn't
      introduce any behavior change.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      
      Rejections fixed and
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      c3c94c5a
  26. 12 3月, 2007 1 次提交