summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2015-10-23 20:46:19 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:01:00 -0700
commitfe64842c81d6b2dc34321dde12530c92d5df556b (patch)
tree74de12de6f51c20bb94cf87f5133f2e4bf63785f
parent4c8c56c5d16955f69c8449ded9222465668cd83b (diff)
scsi: sd: remove check_events callback
->check_events() callback sends the Test Unit Ready command to check if underlying media state has changed or not, this is generally not required for embedded storage media (such as UFS). We have seen race between Test Unit Ready command and runtime suspend context which basically can put the Test Unit Ready command at the head of the request queue when queue's rpm_status is SUSPENDING. In this case, scsi_request_fn will not pull in the Test Unit Ready command as REQ_PM flag is not set for it. This basically causes the deadlock situation. Currently there is no better way to fix this error other than removing the check_events() callback which is anyway not required for embedded storage like UFS. Change-Id: Idac374ba1674fede38cb3dcfc2c1f8d3db234d1d Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
-rw-r--r--drivers/scsi/sd.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8865327f1ffb..4e92d79f8891 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1411,81 +1411,6 @@ static int media_not_present(struct scsi_disk *sdkp,
return 0;
}
-/**
- * sd_check_events - check media events
- * @disk: kernel device descriptor
- * @clearing: disk events currently being cleared
- *
- * Returns mask of DISK_EVENT_*.
- *
- * Note: this function is invoked from the block subsystem.
- **/
-static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
-{
- struct scsi_disk *sdkp = scsi_disk(disk);
- struct scsi_device *sdp = sdkp->device;
- struct scsi_sense_hdr *sshdr = NULL;
- int retval;
-
- SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
-
- /*
- * If the device is offline, don't send any commands - just pretend as
- * if the command failed. If the device ever comes back online, we
- * can deal with it then. It is only because of unrecoverable errors
- * that we would ever take a device offline in the first place.
- */
- if (!scsi_device_online(sdp)) {
- set_media_not_present(sdkp);
- goto out;
- }
-
- /*
- * Using TEST_UNIT_READY enables differentiation between drive with
- * no cartridge loaded - NOT READY, drive with changed cartridge -
- * UNIT ATTENTION, or with same cartridge - GOOD STATUS.
- *
- * Drives that auto spin down. eg iomega jaz 1G, will be started
- * by sd_spinup_disk() from sd_revalidate_disk(), which happens whenever
- * sd_revalidate() is called.
- */
- retval = -ENODEV;
-
- if (scsi_block_when_processing_errors(sdp)) {
- sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL);
- retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES,
- sshdr);
- }
-
- /* failed to execute TUR, assume media not present */
- if (host_byte(retval)) {
- set_media_not_present(sdkp);
- goto out;
- }
-
- if (media_not_present(sdkp, sshdr))
- goto out;
-
- /*
- * For removable scsi disk we have to recognise the presence
- * of a disk in the drive.
- */
- if (!sdkp->media_present)
- sdp->changed = 1;
- sdkp->media_present = 1;
-out:
- /*
- * sdp->changed is set under the following conditions:
- *
- * Medium present state has changed in either direction.
- * Device has indicated UNIT_ATTENTION.
- */
- kfree(sshdr);
- retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
- sdp->changed = 0;
- return retval;
-}
-
static int sd_sync_cache(struct scsi_disk *sdkp)
{
int retries, res;
@@ -1678,7 +1603,6 @@ static const struct block_device_operations sd_fops = {
#ifdef CONFIG_COMPAT
.compat_ioctl = sd_compat_ioctl,
#endif
- .check_events = sd_check_events,
.revalidate_disk = sd_revalidate_disk,
.unlock_native_capacity = sd_unlock_native_capacity,
.pr_ops = &sd_pr_ops,