Commit 04cc50c2 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:
 "Two core fixes: one to prevent discard type changes (seen on iSCSI)
  during intermittent errors and the other is fixing a lockdep problem
  caused by the queue limits change.

  And one driver fix in ufs"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: sd: Keep the discard mode stable
  scsi: sd: Move sd_read_cpr() out of the q->limits_lock region
  scsi: ufs: core: Fix hba->last_dme_cmd_tstamp timestamp updating logic
parents 5189dafa f874d721
...@@ -2711,8 +2711,6 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, ...@@ -2711,8 +2711,6 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
if (buffer[14] & 0x40) /* LBPRZ */ if (buffer[14] & 0x40) /* LBPRZ */
sdkp->lbprz = 1; sdkp->lbprz = 1;
sd_config_discard(sdkp, lim, SD_LBP_WS16);
} }
sdkp->capacity = lba + 1; sdkp->capacity = lba + 1;
...@@ -3365,8 +3363,6 @@ static void sd_read_block_limits(struct scsi_disk *sdkp, ...@@ -3365,8 +3363,6 @@ static void sd_read_block_limits(struct scsi_disk *sdkp,
sdkp->unmap_alignment = sdkp->unmap_alignment =
get_unaligned_be32(&vpd->data[32]) & ~(1 << 31); get_unaligned_be32(&vpd->data[32]) & ~(1 << 31);
sd_config_discard(sdkp, lim, sd_discard_mode(sdkp));
config_atomic: config_atomic:
sdkp->max_atomic = get_unaligned_be32(&vpd->data[44]); sdkp->max_atomic = get_unaligned_be32(&vpd->data[44]);
sdkp->atomic_alignment = get_unaligned_be32(&vpd->data[48]); sdkp->atomic_alignment = get_unaligned_be32(&vpd->data[48]);
...@@ -3753,9 +3749,10 @@ static int sd_revalidate_disk(struct gendisk *disk) ...@@ -3753,9 +3749,10 @@ static int sd_revalidate_disk(struct gendisk *disk)
sd_read_block_limits_ext(sdkp); sd_read_block_limits_ext(sdkp);
sd_read_block_characteristics(sdkp, &lim); sd_read_block_characteristics(sdkp, &lim);
sd_zbc_read_zones(sdkp, &lim, buffer); sd_zbc_read_zones(sdkp, &lim, buffer);
sd_read_cpr(sdkp);
} }
sd_config_discard(sdkp, &lim, sd_discard_mode(sdkp));
sd_print_capacity(sdkp, old_capacity); sd_print_capacity(sdkp, old_capacity);
sd_read_write_protect_flag(sdkp, buffer); sd_read_write_protect_flag(sdkp, buffer);
...@@ -3808,6 +3805,14 @@ static int sd_revalidate_disk(struct gendisk *disk) ...@@ -3808,6 +3805,14 @@ static int sd_revalidate_disk(struct gendisk *disk)
if (err) if (err)
return err; return err;
/*
* Query concurrent positioning ranges after
* queue_limits_commit_update() unlocked q->limits_lock to avoid
* deadlock with q->sysfs_dir_lock and q->sysfs_lock.
*/
if (sdkp->media_present && scsi_device_supports_vpd(sdp))
sd_read_cpr(sdkp);
/* /*
* For a zoned drive, revalidating the zones can be done only once * For a zoned drive, revalidating the zones can be done only once
* the gendisk capacity is set. So if this fails, set back the gendisk * the gendisk capacity is set. So if this fails, set back the gendisk
......
...@@ -4100,11 +4100,16 @@ static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba) ...@@ -4100,11 +4100,16 @@ static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba)
min_sleep_time_us = min_sleep_time_us =
MIN_DELAY_BEFORE_DME_CMDS_US - delta; MIN_DELAY_BEFORE_DME_CMDS_US - delta;
else else
return; /* no more delay required */ min_sleep_time_us = 0; /* no more delay required */
} }
if (min_sleep_time_us > 0) {
/* allow sleep for extra 50us if needed */ /* allow sleep for extra 50us if needed */
usleep_range(min_sleep_time_us, min_sleep_time_us + 50); usleep_range(min_sleep_time_us, min_sleep_time_us + 50);
}
/* update the last_dme_cmd_tstamp */
hba->last_dme_cmd_tstamp = ktime_get();
} }
/** /**
......
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