Commit 14365ea2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This patch set is fixing two serious problems which have turned up
  late in the release cycle.

  The first fixes a problem with 4k sector disks where the transfer
  length (amount of data sent to the disk) was getting increased every
  time the disk was revalidated leading to potential for overflows.

  The other is a regression oops fix for some of our last merge window
  code"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  sd: Fix max transfer length for 4k disks
  scsi: fix device handler detach oops
parents 42345d63 3a9794d3
...@@ -136,11 +136,12 @@ static void __detach_handler (struct kref *kref) ...@@ -136,11 +136,12 @@ static void __detach_handler (struct kref *kref)
struct scsi_device_handler *scsi_dh = scsi_dh_data->scsi_dh; struct scsi_device_handler *scsi_dh = scsi_dh_data->scsi_dh;
struct scsi_device *sdev = scsi_dh_data->sdev; struct scsi_device *sdev = scsi_dh_data->sdev;
scsi_dh->detach(sdev);
spin_lock_irq(sdev->request_queue->queue_lock); spin_lock_irq(sdev->request_queue->queue_lock);
sdev->scsi_dh_data = NULL; sdev->scsi_dh_data = NULL;
spin_unlock_irq(sdev->request_queue->queue_lock); spin_unlock_irq(sdev->request_queue->queue_lock);
scsi_dh->detach(sdev);
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", scsi_dh->name); sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", scsi_dh->name);
module_put(scsi_dh->module); module_put(scsi_dh->module);
} }
......
...@@ -2800,9 +2800,11 @@ static int sd_revalidate_disk(struct gendisk *disk) ...@@ -2800,9 +2800,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
*/ */
sd_set_flush_flag(sdkp); sd_set_flush_flag(sdkp);
max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer = sdkp->max_xfer_blocks;
sdkp->max_xfer_blocks);
max_xfer <<= ilog2(sdp->sector_size) - 9; max_xfer <<= ilog2(sdp->sector_size) - 9;
max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
max_xfer);
blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer); blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
set_capacity(disk, sdkp->capacity); set_capacity(disk, sdkp->capacity);
sd_config_write_same(sdkp); sd_config_write_same(sdkp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment