[Devel] [PATCH RHEL COMMIT] scsi: ratelimit messages about rejected I/O
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Oct 12 16:18:26 MSK 2021
The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 1948887b6dce77036d9361b7b0d42f32d843e7b9
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Tue Oct 12 16:18:26 2021 +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>
(cherry-picked from vz7 commit 734978dda643 ("scsi: ratelimit messages about
rejected I/O"))
https://jira.sw.ru/browse/PSBM-127849
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
gorcunov@:
- (cherry-picked from commit 75fde78a1d9 ("scsi: ratelimit messages about
rejected I/O")
- the name of routine has been changed to scsi_device_state_check
so had to apply the commit manually
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
drivers/scsi/scsi_lib.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7456a26aef51..632a1cddbf22 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1178,6 +1178,8 @@ static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
static blk_status_t
scsi_device_state_check(struct scsi_device *sdev, struct request *req)
{
+ static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10);
+
switch (sdev->sdev_state) {
case SDEV_CREATED:
return BLK_STS_OK;
@@ -1190,8 +1192,10 @@ scsi_device_state_check(struct scsi_device *sdev, struct request *req)
*/
if (!sdev->offline_already) {
sdev->offline_already = true;
- 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");
+ }
}
return BLK_STS_IOERR;
case SDEV_DEL:
@@ -1199,8 +1203,10 @@ scsi_device_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");
+ }
return BLK_STS_IOERR;
case SDEV_BLOCK:
case SDEV_CREATED_BLOCK:
More information about the Devel
mailing list