aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-01-03 18:19:26 -0500
committerJames Bottomley <JBottomley@Parallels.com>2014-03-27 11:26:33 -0400
commitb2bff6ceb61a9a21294f04057d30c9bb4910a88f (patch)
treeae92ba064ed276ef34d560aad344b64044590159 /drivers/scsi
parent89d9a567952baec13e26ada3e438f1b642d66b6e (diff)
[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=733565 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd.c38
-rw-r--r--drivers/scsi/sd.h6
2 files changed, 28 insertions, 16 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 36d1a23f14be..89e6c04ac595 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2281,7 +2281,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
2281 2281
2282 set_disk_ro(sdkp->disk, 0); 2282 set_disk_ro(sdkp->disk, 0);
2283 if (sdp->skip_ms_page_3f) { 2283 if (sdp->skip_ms_page_3f) {
2284 sd_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n"); 2284 sd_first_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n");
2285 return; 2285 return;
2286 } 2286 }
2287 2287
@@ -2313,7 +2313,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
2313 } 2313 }
2314 2314
2315 if (!scsi_status_is_good(res)) { 2315 if (!scsi_status_is_good(res)) {
2316 sd_printk(KERN_WARNING, sdkp, 2316 sd_first_printk(KERN_WARNING, sdkp,
2317 "Test WP failed, assume Write Enabled\n"); 2317 "Test WP failed, assume Write Enabled\n");
2318 } else { 2318 } else {
2319 sdkp->write_prot = ((data.device_specific & 0x80) != 0); 2319 sdkp->write_prot = ((data.device_specific & 0x80) != 0);
@@ -2381,7 +2381,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
2381 if (!data.header_length) { 2381 if (!data.header_length) {
2382 modepage = 6; 2382 modepage = 6;
2383 first_len = 0; 2383 first_len = 0;
2384 sd_printk(KERN_ERR, sdkp, "Missing header in MODE_SENSE response\n"); 2384 sd_first_printk(KERN_ERR, sdkp,
2385 "Missing header in MODE_SENSE response\n");
2385 } 2386 }
2386 2387
2387 /* that went OK, now ask for the proper length */ 2388 /* 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 if (len < 3) 2395 if (len < 3)
2395 goto bad_sense; 2396 goto bad_sense;
2396 else if (len > SD_BUF_SIZE) { 2397 else if (len > SD_BUF_SIZE) {
2397 sd_printk(KERN_NOTICE, sdkp, "Truncating mode parameter " 2398 sd_first_printk(KERN_NOTICE, sdkp, "Truncating mode parameter "
2398 "data from %d to %d bytes\n", len, SD_BUF_SIZE); 2399 "data from %d to %d bytes\n", len, SD_BUF_SIZE);
2399 len = SD_BUF_SIZE; 2400 len = SD_BUF_SIZE;
2400 } 2401 }
@@ -2417,8 +2418,9 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
2417 /* We're interested only in the first 3 bytes. 2418 /* We're interested only in the first 3 bytes.
2418 */ 2419 */
2419 if (len - offset <= 2) { 2420 if (len - offset <= 2) {
2420 sd_printk(KERN_ERR, sdkp, "Incomplete " 2421 sd_first_printk(KERN_ERR, sdkp,
2421 "mode parameter data\n"); 2422 "Incomplete mode parameter "
2423 "data\n");
2422 goto defaults; 2424 goto defaults;
2423 } else { 2425 } else {
2424 modepage = page_code; 2426 modepage = page_code;
@@ -2432,14 +2434,15 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
2432 else if (!spf && len - offset > 1) 2434 else if (!spf && len - offset > 1)
2433 offset += 2 + buffer[offset+1]; 2435 offset += 2 + buffer[offset+1];
2434 else { 2436 else {
2435 sd_printk(KERN_ERR, sdkp, "Incomplete " 2437 sd_first_printk(KERN_ERR, sdkp,
2436 "mode parameter data\n"); 2438 "Incomplete mode "
2439 "parameter data\n");
2437 goto defaults; 2440 goto defaults;
2438 } 2441 }
2439 } 2442 }
2440 } 2443 }
2441 2444
2442 sd_printk(KERN_ERR, sdkp, "No Caching mode page found\n"); 2445 sd_first_printk(KERN_ERR, sdkp, "No Caching mode page found\n");
2443 goto defaults; 2446 goto defaults;
2444 2447
2445 Page_found: 2448 Page_found:
@@ -2453,7 +2456,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
2453 2456
2454 sdkp->DPOFUA = (data.device_specific & 0x10) != 0; 2457 sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
2455 if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { 2458 if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
2456 sd_printk(KERN_NOTICE, sdkp, 2459 sd_first_printk(KERN_NOTICE, sdkp,
2457 "Uses READ/WRITE(6), disabling FUA\n"); 2460 "Uses READ/WRITE(6), disabling FUA\n");
2458 sdkp->DPOFUA = 0; 2461 sdkp->DPOFUA = 0;
2459 } 2462 }
@@ -2475,16 +2478,19 @@ bad_sense:
2475 sshdr.sense_key == ILLEGAL_REQUEST && 2478 sshdr.sense_key == ILLEGAL_REQUEST &&
2476 sshdr.asc == 0x24 && sshdr.ascq == 0x0) 2479 sshdr.asc == 0x24 && sshdr.ascq == 0x0)
2477 /* Invalid field in CDB */ 2480 /* Invalid field in CDB */
2478 sd_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n"); 2481 sd_first_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n");
2479 else 2482 else
2480 sd_printk(KERN_ERR, sdkp, "Asking for cache data failed\n"); 2483 sd_first_printk(KERN_ERR, sdkp,
2484 "Asking for cache data failed\n");
2481 2485
2482defaults: 2486defaults:
2483 if (sdp->wce_default_on) { 2487 if (sdp->wce_default_on) {
2484 sd_printk(KERN_NOTICE, sdkp, "Assuming drive cache: write back\n"); 2488 sd_first_printk(KERN_NOTICE, sdkp,
2489 "Assuming drive cache: write back\n");
2485 sdkp->WCE = 1; 2490 sdkp->WCE = 1;
2486 } else { 2491 } else {
2487 sd_printk(KERN_ERR, sdkp, "Assuming drive cache: write through\n"); 2492 sd_first_printk(KERN_ERR, sdkp,
2493 "Assuming drive cache: write through\n");
2488 sdkp->WCE = 0; 2494 sdkp->WCE = 0;
2489 } 2495 }
2490 sdkp->RCD = 0; 2496 sdkp->RCD = 0;
@@ -2513,7 +2519,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
2513 2519
2514 if (!scsi_status_is_good(res) || !data.header_length || 2520 if (!scsi_status_is_good(res) || !data.header_length ||
2515 data.length < 6) { 2521 data.length < 6) {
2516 sd_printk(KERN_WARNING, sdkp, 2522 sd_first_printk(KERN_WARNING, sdkp,
2517 "getting Control mode page failed, assume no ATO\n"); 2523 "getting Control mode page failed, assume no ATO\n");
2518 2524
2519 if (scsi_sense_valid(&sshdr)) 2525 if (scsi_sense_valid(&sshdr))
@@ -2525,7 +2531,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
2525 offset = data.header_length + data.block_descriptor_length; 2531 offset = data.header_length + data.block_descriptor_length;
2526 2532
2527 if ((buffer[offset] & 0x3f) != 0x0a) { 2533 if ((buffer[offset] & 0x3f) != 0x0a) {
2528 sd_printk(KERN_ERR, sdkp, "ATO Got wrong page\n"); 2534 sd_first_printk(KERN_ERR, sdkp, "ATO Got wrong page\n");
2529 return; 2535 return;
2530 } 2536 }
2531 2537
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 26895ff247c5..620871efbf0a 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -104,6 +104,12 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
104 (sdsk)->disk->disk_name, ##a) : \ 104 (sdsk)->disk->disk_name, ##a) : \
105 sdev_printk(prefix, (sdsk)->device, fmt, ##a) 105 sdev_printk(prefix, (sdsk)->device, fmt, ##a)
106 106
107#define sd_first_printk(prefix, sdsk, fmt, a...) \
108 do { \
109 if ((sdkp)->first_scan) \
110 sd_printk(prefix, sdsk, fmt, ##a); \
111 } while (0)
112
107static inline int scsi_medium_access_command(struct scsi_cmnd *scmd) 113static inline int scsi_medium_access_command(struct scsi_cmnd *scmd)
108{ 114{
109 switch (scmd->cmnd[0]) { 115 switch (scmd->cmnd[0]) {