[Devel] [PATCH RHEL7 COMMIT] scsi: ratelimit messages about rejected I/O
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Dec 30 14:51:37 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.7
------>
commit 734978dda64359d9256a0d9a67ca546044ccc963
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Fri Dec 27 18:50:18 2019 +0300
scsi: ratelimit messages about rejected I/O
Don't flood logs with messages like
"sd 1:0:0:0: rejecting I/O to offline device".
On one hand this flooding is not useful for investigations,
on anothre hand it can make serial console to feed up.
https://jira.sw.ru/browse/PSBM-100118
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
drivers/scsi/scsi_lib.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c36e326f46a72..0db8a47be93c0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1219,6 +1219,8 @@ static int scsi_setup_cmnd(struct scsi_device *sdev, struct request *req)
static int
scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
{
+ static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10);
+
int ret = BLKPREP_OK;
/*
@@ -1234,8 +1236,9 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
* commands. The device must be brought online
* before trying any recovery commands.
*/
- sdev_printk(KERN_ERR, sdev,
- "rejecting I/O to offline device\n");
+ if (__ratelimit(&ratelimit))
+ sdev_printk(KERN_ERR, sdev,
+ "rejecting I/O to offline device\n");
ret = BLKPREP_KILL;
break;
case SDEV_DEL:
@@ -1243,8 +1246,9 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
* If the device is fully deleted, we refuse to
* process any commands as well.
*/
- sdev_printk(KERN_ERR, sdev,
- "rejecting I/O to dead device\n");
+ if (__ratelimit(&ratelimit))
+ sdev_printk(KERN_ERR, sdev,
+ "rejecting I/O to dead device\n");
ret = BLKPREP_KILL;
break;
case SDEV_QUIESCE:
More information about the Devel
mailing list