scsi_lib: rate-limit the error message from failing commands
PATCH v4 1/1 scsi_lib: rate-limit the error message from failing commands
[
James,
Not sure why you could not see the original v3 on the list as the block part was pulled ok by Jens. Anyway, I have diffsplitted the v3 and v4 below is the scsi_lib part only, hopefully this works for you, pls let me know. Below is directly applicable against the current upstream 3.6-rc7 tip.
]
Resending as v4 for the change on scsi_lib part, where the corresponding block part is at commit 37d7b34. Threads related to this can be found at:
http://marc.info/?l=linux-scsi&m=134830150821548&w=2
http://comments.gmane.org/gmane.linux.scsi/73497
http://www.open-fcoe.org/patchwork/patch/2436/
---
drivers/scsi/scsi_lib.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/scsi_lib.c +4 -1
@@ -20,6 +20,7 @@#include <linux/delay.h> #include <linux/hardirq.h> #include <linux/scatterlist.h> +#include <linux/ratelimit.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h>
@@ -768,6 +769,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)enum {ACTION_FAIL ,ACTION_REPREP ,ACTION_RETRY ,ACTION_DELAYED_RETRY } action;char *description =NULL ; + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST);if (result) { sense_valid =scsi_command_normalize_sense (cmd, &sshdr);
@@ -961,7 +964,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)case ACTION_FAIL :/* Give up and fail the remainder of the request */ scsi_release_buffers (cmd); -if (!(req->cmd_flags &REQ_QUIET )) { +if (!(req->cmd_flags &REQ_QUIET ) &&__ratelimit (&rs)) {if (description)scmd_printk (KERN_INFO , cmd,"%s\n" , description);
A message that is not in the archive (sent off-list or not yet received): 20120924195709.18104.65833.stg.yi.zou-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Quoted 17 lines
[
James,Not sure why you could not see the original v3 on the list as the block part was pulled ok by Jens. Anyway, I have diffsplitted the v3 and v4 below is the
scsi_libpart only, hopefully this works for you, pls let me know. Below is directly applicable against the current upstream 3.6-rc7 tip.]
Resending as v4 for the change on
scsi_libpart, where the corresponding block part is at commit 37d7b34. Threads related to this can be found at:http://marc.info/?l=linux-scsi&m=134830150821548&w=2
http://comments.gmane.org/gmane.linux.scsi/73497
http://www.open-fcoe.org/patchwork/patch/2436/
Quoted 5 lines
Signed-off-by Yi Zou <[email protected]>Cc www.Open-FCoE.org <[email protected]>Cc Tomas Henzl <[email protected]>Cc <[email protected]>Cc Jens Axboe <axboe-tSWWG44O7X1aa/[email protected]>
James,
Can you please apply this patch? I have been just being updating this patch for four versions over and over and it was acked long time ago that I don't even remember how long already. I also resent as you requested a month ago again.
Thanks,
yi
Quoted 37 lines
---
drivers/scsi/scsi_lib.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/scsi/scsi_lib.c +3
-0@@ -20,6 +20,7 @@#include <linux/delay.h> #include <linux/hardirq.h> #include <linux/scatterlist.h> +#include <linux/ratelimit.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -768,6 +769,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)enum {ACTION_FAIL ,ACTION_REPREP ,ACTION_RETRY ,ACTION_DELAYED_RETRY } action;char *description =NULL ; + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST);if (result) {drivers/scsi/scsi_lib.c +1
-1sense_valid =scsi_command_normalize_sense (cmd, &sshdr);@@ -961,7 +964,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)case ACTION_FAIL :/* Give up and fail the remainder of the request */ scsi_release_buffers (cmd); -if (!(req->cmd_flags &REQ_QUIET )) { +if (!(req->cmd_flags &REQ_QUIET ) &&__ratelimit (&rs)) {if (description) scmd_printk(KERN_INFO, cmd, "%s\n",description);