Commit:     eaa3e22e8d32bf7a6176f04efad90f4a5aa67f58
Parent:     d496f94d22d1491ffb25f4000e85f7a4ecf7f2c4
Author:     Andi Kleen <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 13 17:41:43 2008 +0100
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Wed Jan 23 11:29:27 2008 -0600

    [SCSI] sg: Only print SCSI data direction warning once for a command
    When I use cdparanoia my logs get spammed a lot by
    printk: 464 messages suppressed.
    sg_write: data in/out 30576/30576 bytes for SCSI command 0xbe--guessing 
data in;
       program cdparanoia not setting count and/or reply_len properly
    printk: 1078 messages suppressed.
    and many more of those. With this patch the message is only printed once
    for a command in a row.
    v1->v2: Prevent rate limit messages too (pointed out by jejb)
    Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
    Acked-by: Douglas Gilbert <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
 drivers/scsi/sg.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index f1871ea..e65f5d4 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -602,8 +602,9 @@ sg_write(struct file *filp, const char __user *buf, size_t 
count, loff_t * ppos)
         * but is is possible that the app intended SG_DXFER_TO_DEV, because 
         * is a non-zero input_size, so emit a warning.
-       if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV)
-               if (printk_ratelimit())
+       if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV) {
+               static char cmd[TASK_COMM_LEN];
+               if (strcmp(current->comm, cmd) && printk_ratelimit()) {
                               "sg_write: data in/out %d/%d bytes for SCSI 
command 0x%x--"
                               "guessing data in;\n" KERN_WARNING "   "
@@ -611,6 +612,9 @@ sg_write(struct file *filp, const char __user *buf, size_t 
count, loff_t * ppos)
                               old_hdr.reply_len - (int)SZ_SG_HEADER,
                               input_size, (unsigned int) cmnd[0],
+                       strcpy(cmd, current->comm);
+               }
+       }
        k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking);
        return (k < 0) ? k : count;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to