From: Jack Wang <jinpu.w...@profitbricks.com>

The check_events interface was added for check if device changes,
mainly for device is removable eg. CDROM

In sd_open, it checks if device is removable then check_disk_change.

when the device is not removable, we can simple succeeds the call
without send TUR.

Signed-off-by: Jack Wang <jinpu.w...@profitbricks.com>
---
 drivers/scsi/sd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ab75ebd..773ce81 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1576,6 +1576,10 @@ static unsigned int sd_check_events(struct gendisk 
*disk, unsigned int clearing)
        sdp = sdkp->device;
        SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
 
+       if (!sdp->removable) {
+               retval = 0;
+               goto out;
+       }
        /*
         * 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
-- 
2.7.4

Reply via email to