Commit b2bff6ce authored by Martin K. Petersen's avatar Martin K. Petersen Committed by James Bottomley

[SCSI] sd: Quiesce mode sense error messages

Messages about discovered disk properties are only printed once unless
they are found to have changed. Errors encountered during mode sense,
however, are printed every time we revalidate.

Quiesce mode sense errors so they are only printed during the first
scan.

[jejb: checkpatch fixes]
Bugzilla: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733565Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 89d9a567
...@@ -2281,7 +2281,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2281,7 +2281,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
set_disk_ro(sdkp->disk, 0); set_disk_ro(sdkp->disk, 0);
if (sdp->skip_ms_page_3f) { if (sdp->skip_ms_page_3f) {
sd_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n"); sd_first_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n");
return; return;
} }
...@@ -2313,7 +2313,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2313,7 +2313,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
} }
if (!scsi_status_is_good(res)) { if (!scsi_status_is_good(res)) {
sd_printk(KERN_WARNING, sdkp, sd_first_printk(KERN_WARNING, sdkp,
"Test WP failed, assume Write Enabled\n"); "Test WP failed, assume Write Enabled\n");
} else { } else {
sdkp->write_prot = ((data.device_specific & 0x80) != 0); sdkp->write_prot = ((data.device_specific & 0x80) != 0);
...@@ -2381,7 +2381,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2381,7 +2381,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
if (!data.header_length) { if (!data.header_length) {
modepage = 6; modepage = 6;
first_len = 0; first_len = 0;
sd_printk(KERN_ERR, sdkp, "Missing header in MODE_SENSE response\n"); sd_first_printk(KERN_ERR, sdkp,
"Missing header in MODE_SENSE response\n");
} }
/* that went OK, now ask for the proper length */ /* that went OK, now ask for the proper length */
...@@ -2394,7 +2395,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2394,7 +2395,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
if (len < 3) if (len < 3)
goto bad_sense; goto bad_sense;
else if (len > SD_BUF_SIZE) { else if (len > SD_BUF_SIZE) {
sd_printk(KERN_NOTICE, sdkp, "Truncating mode parameter " sd_first_printk(KERN_NOTICE, sdkp, "Truncating mode parameter "
"data from %d to %d bytes\n", len, SD_BUF_SIZE); "data from %d to %d bytes\n", len, SD_BUF_SIZE);
len = SD_BUF_SIZE; len = SD_BUF_SIZE;
} }
...@@ -2417,8 +2418,9 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2417,8 +2418,9 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
/* We're interested only in the first 3 bytes. /* We're interested only in the first 3 bytes.
*/ */
if (len - offset <= 2) { if (len - offset <= 2) {
sd_printk(KERN_ERR, sdkp, "Incomplete " sd_first_printk(KERN_ERR, sdkp,
"mode parameter data\n"); "Incomplete mode parameter "
"data\n");
goto defaults; goto defaults;
} else { } else {
modepage = page_code; modepage = page_code;
...@@ -2432,14 +2434,15 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2432,14 +2434,15 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
else if (!spf && len - offset > 1) else if (!spf && len - offset > 1)
offset += 2 + buffer[offset+1]; offset += 2 + buffer[offset+1];
else { else {
sd_printk(KERN_ERR, sdkp, "Incomplete " sd_first_printk(KERN_ERR, sdkp,
"mode parameter data\n"); "Incomplete mode "
"parameter data\n");
goto defaults; goto defaults;
} }
} }
} }
sd_printk(KERN_ERR, sdkp, "No Caching mode page found\n"); sd_first_printk(KERN_ERR, sdkp, "No Caching mode page found\n");
goto defaults; goto defaults;
Page_found: Page_found:
...@@ -2453,7 +2456,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2453,7 +2456,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
sdkp->DPOFUA = (data.device_specific & 0x10) != 0; sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
sd_printk(KERN_NOTICE, sdkp, sd_first_printk(KERN_NOTICE, sdkp,
"Uses READ/WRITE(6), disabling FUA\n"); "Uses READ/WRITE(6), disabling FUA\n");
sdkp->DPOFUA = 0; sdkp->DPOFUA = 0;
} }
...@@ -2475,16 +2478,19 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2475,16 +2478,19 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
sshdr.sense_key == ILLEGAL_REQUEST && sshdr.sense_key == ILLEGAL_REQUEST &&
sshdr.asc == 0x24 && sshdr.ascq == 0x0) sshdr.asc == 0x24 && sshdr.ascq == 0x0)
/* Invalid field in CDB */ /* Invalid field in CDB */
sd_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n"); sd_first_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n");
else else
sd_printk(KERN_ERR, sdkp, "Asking for cache data failed\n"); sd_first_printk(KERN_ERR, sdkp,
"Asking for cache data failed\n");
defaults: defaults:
if (sdp->wce_default_on) { if (sdp->wce_default_on) {
sd_printk(KERN_NOTICE, sdkp, "Assuming drive cache: write back\n"); sd_first_printk(KERN_NOTICE, sdkp,
"Assuming drive cache: write back\n");
sdkp->WCE = 1; sdkp->WCE = 1;
} else { } else {
sd_printk(KERN_ERR, sdkp, "Assuming drive cache: write through\n"); sd_first_printk(KERN_ERR, sdkp,
"Assuming drive cache: write through\n");
sdkp->WCE = 0; sdkp->WCE = 0;
} }
sdkp->RCD = 0; sdkp->RCD = 0;
...@@ -2513,7 +2519,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2513,7 +2519,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
if (!scsi_status_is_good(res) || !data.header_length || if (!scsi_status_is_good(res) || !data.header_length ||
data.length < 6) { data.length < 6) {
sd_printk(KERN_WARNING, sdkp, sd_first_printk(KERN_WARNING, sdkp,
"getting Control mode page failed, assume no ATO\n"); "getting Control mode page failed, assume no ATO\n");
if (scsi_sense_valid(&sshdr)) if (scsi_sense_valid(&sshdr))
...@@ -2525,7 +2531,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2525,7 +2531,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
offset = data.header_length + data.block_descriptor_length; offset = data.header_length + data.block_descriptor_length;
if ((buffer[offset] & 0x3f) != 0x0a) { if ((buffer[offset] & 0x3f) != 0x0a) {
sd_printk(KERN_ERR, sdkp, "ATO Got wrong page\n"); sd_first_printk(KERN_ERR, sdkp, "ATO Got wrong page\n");
return; return;
} }
......
...@@ -104,6 +104,12 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) ...@@ -104,6 +104,12 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
(sdsk)->disk->disk_name, ##a) : \ (sdsk)->disk->disk_name, ##a) : \
sdev_printk(prefix, (sdsk)->device, fmt, ##a) sdev_printk(prefix, (sdsk)->device, fmt, ##a)
#define sd_first_printk(prefix, sdsk, fmt, a...) \
do { \
if ((sdkp)->first_scan) \
sd_printk(prefix, sdsk, fmt, ##a); \
} while (0)
static inline int scsi_medium_access_command(struct scsi_cmnd *scmd) static inline int scsi_medium_access_command(struct scsi_cmnd *scmd)
{ {
switch (scmd->cmnd[0]) { switch (scmd->cmnd[0]) {
......
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