SCSI fixes on 20160129

Four fixes: one to try to fix our repeated intermittent crashes in
 suspend/resume, one to correct a regression in the optimal I/O size reporting
 and a couple for randconfig build failures in the hisi_sas driver.
 
 Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABAgAGBQJWq5IaAAoJEDeqqVYsXL0Mw1gH/0TPGjFxXOK9z2LsaOq7t+j2
 20lrgbe5BSqmkOpwCB5Uh61YT38PdzA9a8DmGuVntwdFCP9Pbk0AJcjmOCExvb0d
 pR+G681As2I6HR9Q8mmK4xNjFtlGlpZTfGShF/iIOsa3+qMgcT/IypRiE71PcsOl
 e2fvS2+DUiiDzDFWQpWXgWZQ/hdpHeAAhuDeZFCoNkm9+BATg0xfWjWhkVkuRE+/
 WFTzjXCUXdrVYtinC1d+T4SQkQuGgg2fZmmpscbvmzWnXndw07NvV+u1SWFkafSL
 BkiBUJbHBIqHuI5qQrz2dp2b9iaTfsk8H9rRyMa5M+lOleQluWU7YAjMphHk/G0=
 =S+Mu
 -----END PGP SIGNATURE-----

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

Pull SCSI fixes from James Bottomley:
 "Four fixes: one to try to fix our repeated intermittent crashes in
  suspend/resume, one to correct a regression in the optimal I/O size
  reporting and a couple for randconfig build failures in the hisi_sas
  driver"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  SCSI: fix crashes in sd and sr runtime PM
  sd: Optimal I/O size is in bytes, not sectors
  hisi_sas: Restrict SCSI_HISI_SAS to arm64
  hisi_sas: SCSI_HISI_SAS should depend on HAS_DMA
This commit is contained in:
Linus Torvalds 2016-01-29 13:14:45 -08:00
commit a12883f0af
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,7 @@
config SCSI_HISI_SAS
tristate "HiSilicon SAS"
depends on HAS_DMA
depends on ARM64 || COMPILE_TEST
select SCSI_SAS_LIBSAS
select BLK_DEV_INTEGRITY
help

View file

@ -2893,7 +2893,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
rw_max = q->limits.io_opt =
logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
sdkp->opt_xfer_blocks * sdp->sector_size;
else
rw_max = BLK_DEF_MAX_SECTORS;
@ -3268,8 +3268,8 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
struct scsi_disk *sdkp = dev_get_drvdata(dev);
int ret = 0;
if (!sdkp)
return 0; /* this can happen */
if (!sdkp) /* E.g.: runtime suspend following sd_remove() */
return 0;
if (sdkp->WCE && sdkp->media_present) {
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
@ -3308,6 +3308,9 @@ static int sd_resume(struct device *dev)
{
struct scsi_disk *sdkp = dev_get_drvdata(dev);
if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
return 0;
if (!sdkp->device->manage_start_stop)
return 0;

View file

@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev)
{
struct scsi_cd *cd = dev_get_drvdata(dev);
if (!cd) /* E.g.: runtime suspend following sr_remove() */
return 0;
if (cd->media_present)
return -EBUSY;
else
@ -985,6 +988,7 @@ static int sr_remove(struct device *dev)
scsi_autopm_get_device(cd->device);
del_gendisk(cd->disk);
dev_set_drvdata(dev, NULL);
mutex_lock(&sr_ref_mutex);
kref_put(&cd->kref, sr_kref_release);