Skip to contentSkip to conversation

sd: Reduce log level to KERN_NOTICE for missing caching mode page

PATCH In review Alain Kalker 2 participants 4 messages Jun 2, 2014 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sd: Reduce log level to KERN_NOTICE for missing caching mode page

Reduce the lernel log level to KERN_NOTICE for messages related to a missing caching mode page.

Reasons why I think this change is justified:
- The condition is not an error; the existing workaround of assuming a write through cache doesn't limit functionality in any way.
- It doesn't warrant a warning either: as it is most likely a hardware limitation, there is little that an ordinary user can do about it besides replacing the affected hardware.
Making it a warning would still break quiet boot (kernel commandline parameter 'quiet'), and may still trip log monitoring software unneccessarily, either on every boot or whenever an affected external device is plugged in.
- It should be a notice, for it is a normal but significant condition, as it may impact write performance. This would bring it on par with the log messages in the same function.

---
 drivers/scsi/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/sd.c +2 -2
index efcbcd1..5f0f6c6 100644
@@ -2442,7 +2442,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
 			}
 		}
 
-		sd_first_printk(KERN_ERR, sdkp, "No Caching mode page found\n");
+		sd_first_printk(KERN_NOTICE, sdkp, "No Caching mode page found\n");
 		goto defaults;
 
 	Page_found:
@@ -2489,7 +2489,7 @@ defaults:
 				"Assuming drive cache: write back\n");
 		sdkp->WCE = 1;
 	} else {
-		sd_first_printk(KERN_ERR, sdkp,
+		sd_first_printk(KERN_NOTICE, sdkp,
 				"Assuming drive cache: write through\n");
 		sdkp->WCE = 0;
 	}
Signature · 1 line
2.0.0
#1 lore raw
Quoted 2 lines · Alain Kalker

Reduce the lernel log level to KERN_NOTICE for messages related to a missing caching mode page.

There is an open bug report at kernel.org (dating all the way back to Linux 2.6.34.1) about this:
Bug 16490 – "Assuming drive cache: write through" messages probably have wrong loglevel : https://bugzilla.kernel.org/show_bug.cgi?id=16490

Also, many people are asking questions about this on internet fora, submitting bug reports to bugtrackers for their distributions, apparently the error log level makes them think their system is malfunctioning in some way.

Quoted 34 lines

Reasons why I think this change is justified:
- The condition is not an error; the existing workaround of assuming a write through cache doesn't limit functionality in any way.
- It doesn't warrant a warning either: as it is most likely a hardware limitation, there is little that an ordinary user can do about it besides replacing the affected hardware.
Making it a warning would still break quiet boot (kernel commandline parameter 'quiet'), and may still trip log monitoring software unneccessarily, either on every boot or whenever an affected external device is plugged in.
- It should be a notice, for it is a normal but significant condition, as it may impact write performance. This would bring it on par with the log messages in the same function.

---
  drivers/scsi/sd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/sd.c +1 -1
index efcbcd1..5f0f6c6 100644
@@ -2442,7 +2442,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
  			}
  		}
 
-		sd_first_printk(KERN_ERR, sdkp, "No Caching mode page found\n");
+		sd_first_printk(KERN_NOTICE, sdkp, "No Caching mode page found\n");
  		goto defaults;
 
  	Page_found:

drivers/scsi/sd.c defaults: · line 2495

Quoted 8 lines
drivers/scsi/sd.c +1 -1
@@ -2489,7 +2489,7 @@ defaults:
  				"Assuming drive cache: write back\n");
  		sdkp->WCE = 1;
  	} else {
-		sd_first_printk(KERN_ERR, sdkp,
+		sd_first_printk(KERN_NOTICE, sdkp,
  				"Assuming drive cache: write through\n");
  		sdkp->WCE = 0;
  	}

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#2 lore raw
In reply to Alain Kalker
Quoted 6 lines · Alain Kalker

Reduce the lernel log level to KERN_NOTICE for messages related to a missing caching mode page.

Reasons why I think this change is justified:
- The condition is not an error; the existing workaround of assuming a write through cache doesn't limit functionality in any way.

That's not actually correct. The condition may be an error. We have some USB attached storage devices with writeback caches which don't supply caching information. Treating a writeback device as writethrough is a potential error because you may lose data as a result of it.

The error is that we've made an assumption which may damage your data.

The problem for us is that we can't tell if the assumption is going to be fatal or not ... the message is harmless for older USB devices.

Quoted 10 lines

- It doesn't warrant a warning either: as it is most likely a hardware limitation, there is little that an ordinary user can do about it besides replacing the affected hardware.
Making it a warning would still break quiet boot (kernel commandline parameter 'quiet'), and may still trip log monitoring software unneccessarily, either on every boot or whenever an affected external device is plugged in.
- It should be a notice, for it is a normal but significant condition, as it may impact write performance. This would bring it on par with the log messages in the same function.

But this message may serve a purpose: If you see it and you find you do have a USB device with a writeback cache, you can set the boot system to correct the cache type assumption and we'll send the correcting synchronize cache commands.

It certainly helps bug triagers identify issues which may require adding a particular device to the list that need to be treated as writeback.

James

#3 lore raw
Quoted 4 lines · James Bottomley
Quoted 3 lines · Alain Kalker

Reduce the lernel log level to KERN_NOTICE for messages related to a missing caching mode page.

Quoted 8 lines
Quoted 3 lines

Reasons why I think this change is justified:
- The condition is not an error; the existing workaround of assuming a write through cache doesn't limit functionality in any way.

That's not actually correct. The condition may be an error. We have some USB attached storage devices with writeback caches which don't supply caching information. Treating a writeback device as writethrough is a potential error because you may lose data as a result of it.

Aha, I thought that the write through treatment would always make sure that the device has written all the data before returning. If that's not always true, then I agree that the condition could be an error.

Quoted 4 lines

The error is that we've made an assumption which may damage your data.

The problem for us is that we can't tell if the assumption is going to be fatal or not ... the message is harmless for older USB devices.

I think that I wrongly assumed that only (older?) writethrough devices might not return caching information. If there are also writeback devices which don't return (correct) information, then I have to agree.

Quoted 11 lines
Quoted 10 lines

- It doesn't warrant a warning either: as it is most likely a hardware limitation, there is little that an ordinary user can do about it besides replacing the affected hardware.
Making it a warning would still break quiet boot (kernel commandline parameter 'quiet'), and may still trip log monitoring software unneccessarily, either on every boot or whenever an affected external device is plugged in.
- It should be a notice, for it is a normal but significant condition, as it may impact write performance. This would bring it on par with the log messages in the same function.

Quoted 4 lines

But this message may serve a purpose: If you see it and you find you do have a USB device with a writeback cache, you can set the boot system to correct the cache type assumption and we'll send the correcting synchronize cache commands.

Very informative, thanks!
I do think that this should be documented somewhere, especially with regard to the risk of data loss. People might think that falling back on writethrough is always a 'safe bet' where it actually might not be.

Quoted 2 lines

It certainly helps bug triagers identify issues which may require adding a particular device to the list that need to be treated as writeback.

Thanks for your feedback, much appreciated.

Alain