From: Joe Perches <joe@perches.com>
To: "Ewan D. Milne" <emilne@redhat.com>,
Daniel Wagner <dwagner@suse.de>,
linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH] scsi: core: Rate limit "rejecting I/O" messages
Date: Wed, 08 Apr 2020 12:49:52 -0700 [thread overview]
Message-ID: <2de69a35463317f5eca2ce665b0ee8b90b8c717b.camel@perches.com> (raw)
In-Reply-To: <120ce7f4cd1fd070e1f7c353223c21b8e4f29337.camel@redhat.com>
On Wed, 2020-04-08 at 15:16 -0400, Ewan D. Milne wrote:
> On Wed, 2020-04-08 at 19:10 +0200, Daniel Wagner wrote:
> > Prevent excessive logging by rate limiting the "rejecting I/O"
> > messages. For example in setups where remote syslog is used the link
> > is saturated by those messages when a storage controller/disk
> > misbehaves.
> >
> > Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
> > Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> > Signed-off-by: Daniel Wagner <dwagner@suse.de>
> > ---
> > drivers/scsi/scsi_lib.c | 4 ++--
> > include/scsi/scsi_device.h | 10 ++++++++++
> > 2 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> > index 47835c4b4ee0..01c35c58c6f3 100644
> > --- a/drivers/scsi/scsi_lib.c
> > +++ b/drivers/scsi/scsi_lib.c
> > @@ -1217,7 +1217,7 @@ scsi_prep_state_check(struct scsi_device *sdev,
> > struct request *req)
> > */
> > if (!sdev->offline_already) {
> > sdev->offline_already = true;
> > - sdev_printk(KERN_ERR, sdev,
> > + sdev_printk_ratelimited(KERN_ERR, sdev,
> > "rejecting I/O to offline
> > device\n");
>
> I would really prefer we not do it this way if at all possible.
> It loses information we may need to debug SAN outage problems.
>
> The reason I didn't use ratelimit is that the ratelimit structure is
> per-instance of the ratelimit call here, not per-device. So this
> doesn't work right -- it will drop messages for other devices.
Could add a ratelimit_state to struct scsi_device.
Something like:
---
drivers/scsi/scsi_scan.c | 2 ++
include/scsi/scsi_device.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f2437a..938c83f 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -279,6 +279,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun ?
sdev->host->cmd_per_lun : 1);
+ ratelimit_state_init(&sdev->rs, DEFAULT_RATELIMIT_INTERVAL,
+ DEFAULT_RATELIMIT_BURST);
scsi_sysfs_device_initialize(sdev);
if (shost->hostt->slave_alloc) {
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index c3cba2..2600de7 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -8,6 +8,7 @@
#include <linux/blkdev.h>
#include <scsi/scsi.h>
#include <linux/atomic.h>
+#include <linux/ratelimit.h>
struct device;
struct request_queue;
@@ -233,6 +234,7 @@ struct scsi_device {
struct mutex state_mutex;
enum scsi_device_state sdev_state;
struct task_struct *quiesced_by;
+ struct ratelimit_state rs;
unsigned long sdev_data[];
} __attribute__((aligned(sizeof(unsigned long))));
next prev parent reply other threads:[~2020-04-08 19:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 17:10 [PATCH] scsi: core: Rate limit "rejecting I/O" messages Daniel Wagner
2020-04-08 17:36 ` James Bottomley
2020-04-08 19:16 ` Ewan D. Milne
2020-04-08 19:49 ` Joe Perches [this message]
2020-04-09 17:07 ` Ewan D. Milne
2020-04-09 7:36 ` Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2de69a35463317f5eca2ce665b0ee8b90b8c717b.camel@perches.com \
--to=joe@perches.com \
--cc=dwagner@suse.de \
--cc=emilne@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).