linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited
@ 2018-09-07 10:39 Colin King
  2018-09-14 11:26 ` Joe Perches
  2018-09-17  6:48 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2018-09-07 10:39 UTC (permalink / raw)
  To: Sathya Prakash, Chaitra P B, Suganath Prabu Subramani,
	James E . J . Bottomley, Martin K . Petersen,
	MPT-FusionLinux.pdl, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

It is possible to heavily spam the kernel logs with messages by
excessive reading of the mpt3sas sysfs files.  Make the error messages
ratelimited to reduce the spamming effect.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 5e8c059ce2c9..656cec5adb17 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -2958,7 +2958,7 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr,
 	ssize_t rc = 0;
 
 	if (!ioc->is_warpdrive) {
-		pr_err(MPT3SAS_FMT "%s: BRM attribute is only for"
+		pr_err_ratelimited(MPT3SAS_FMT "%s: BRM attribute is only for"
 		    " warpdrive\n", ioc->name, __func__);
 		goto out;
 	}
@@ -3039,7 +3039,7 @@ _ctl_host_trace_buffer_size_show(struct device *cdev,
 	struct DIAG_BUFFER_START *request_data;
 
 	if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
-		pr_err(MPT3SAS_FMT
+		pr_err_ratelimited(MPT3SAS_FMT
 			"%s: host_trace_buffer is not registered\n",
 			ioc->name, __func__);
 		return 0;
@@ -3047,7 +3047,7 @@ _ctl_host_trace_buffer_size_show(struct device *cdev,
 
 	if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
 	    MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
-		pr_err(MPT3SAS_FMT
+		pr_err_ratelimited(MPT3SAS_FMT
 			"%s: host_trace_buffer is not registered\n",
 			ioc->name, __func__);
 		return 0;
@@ -3089,7 +3089,7 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr,
 	u32 size;
 
 	if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
-		pr_err(MPT3SAS_FMT
+		pr_err_ratelimited(MPT3SAS_FMT
 			"%s: host_trace_buffer is not registered\n",
 			ioc->name, __func__);
 		return 0;
@@ -3097,7 +3097,7 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr,
 
 	if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
 	    MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
-		pr_err(MPT3SAS_FMT
+		pr_err_ratelimited(MPT3SAS_FMT
 			"%s: host_trace_buffer is not registered\n",
 			ioc->name, __func__);
 		return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited
  2018-09-07 10:39 [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited Colin King
@ 2018-09-14 11:26 ` Joe Perches
  2018-09-17  6:48 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2018-09-14 11:26 UTC (permalink / raw)
  To: Colin King, Sathya Prakash, Chaitra P B,
	Suganath Prabu Subramani, James E . J . Bottomley,
	Martin K . Petersen, MPT-FusionLinux.pdl, linux-scsi
  Cc: kernel-janitors, linux-kernel

On Fri, 2018-09-07 at 11:39 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> It is possible to heavily spam the kernel logs with messages by
> excessive reading of the mpt3sas sysfs files.  Make the error messages
> ratelimited to reduce the spamming effect.
[]
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
[]
> @@ -2958,7 +2958,7 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr,
>  	ssize_t rc = 0;
>  
>  	if (!ioc->is_warpdrive) {
> -		pr_err(MPT3SAS_FMT "%s: BRM attribute is only for"
> +		pr_err_ratelimited(MPT3SAS_FMT "%s: BRM attribute is only for"
>  		    " warpdrive\n", ioc->name, __func__);
>  		goto out;
>  	}

trivia:

All the uses of MPT3SAS_FMT in drivers/scsi/mpt3sas/ seem
not nice.  It obfuscate the format and arguments.

Perhaps better would be create ioc_<level> macros.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited
  2018-09-07 10:39 [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited Colin King
  2018-09-14 11:26 ` Joe Perches
@ 2018-09-17  6:48 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2018-09-17  6:48 UTC (permalink / raw)
  To: Colin King
  Cc: Sathya Prakash, Chaitra P B, Suganath Prabu Subramani,
	James E . J . Bottomley, Martin K . Petersen,
	MPT-FusionLinux.pdl, linux-scsi, kernel-janitors, linux-kernel


Colin,

> It is possible to heavily spam the kernel logs with messages by
> excessive reading of the mpt3sas sysfs files.  Make the error messages
> ratelimited to reduce the spamming effect.

That's a bug. Please just nuke all of these.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-17  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-07 10:39 [PATCH] scsi: mpt3sas: make sysfs error messages ratelimited Colin King
2018-09-14 11:26 ` Joe Perches
2018-09-17  6:48 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).