lkml.org 
[lkml]   [2004]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Nasty log spamming problem in ide proc changes
On Thu, 11 Nov 2004 17:10:21 +0100, Jens Axboe <axboe@suse.de> wrote:
> On Thu, Nov 11 2004, Alan Cox wrote:
> > > + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> > > + "obsolete, and will be removed soon!\n");
> > > +
> >
> > The above should be rate limited or on the write case moved to after
> > the capable() check. A program polling these settings now makes a nasty
> > noise and wipes the logs. A user can also do it intentionally.
>
> Or just print it once...

I'm about to add this to ide-2.6...

[ide] fix /proc/ide/hd?/settings to not spam logs

On Thu, 11 Nov 2004 17:10:21 +0100, Jens Axboe <axboe@suse.de> wrote:
> On Thu, Nov 11 2004, Alan Cox wrote:
> > > + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> > > + "obsolete, and will be removed soon!\n");
> > > +
> >
> > The above should be rate limited or on the write case moved to after
> > the capable() check. A program polling these settings now makes a nasty
> > noise and wipes the logs. A user can also do it intentionally.
>
> Or just print it once...

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c 2004-11-17 23:56:13 +01:00
+++ b/drivers/ide/ide-proc.c 2004-11-17 23:56:13 +01:00
@@ -124,6 +124,18 @@
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}

+static void proc_ide_settings_warn(void)
+{
+ static int warned = 0;
+
+ if (warned)
+ return;
+
+ printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
+ "obsolete, and will be removed soon!\n");
+ warned = 1;
+}
+
static int proc_ide_read_settings
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
@@ -132,8 +144,7 @@
char *out = page;
int len, rc, mul_factor, div_factor;

- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
- "obsolete, and will be removed soon!\n");
+ proc_ide_settings_warn();

down(&ide_setting_sem);
out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
@@ -171,11 +182,10 @@
ide_settings_t *setting;
char *buf, *s;

- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
- "obsolete, and will be removed soon!\n");
-
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
+
+ proc_ide_settings_warn();

if (count >= PAGE_SIZE)
return -EINVAL;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.043 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site