Skip to contentSkip to conversation

Nasty log spamming problem in ide proc changes

DISCUSSION Alan Cox 3 participants 3 messages Nov 11, 2004 – Nov 17, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Alan Cox

author
#1 lore raw
Quoted 6 lines · Linux Kernel Mailing List

ChangeSet 1.2424.1.2, 2004/11/01 18:18:35+01:00, bzolnier@trik.(none)

[ide] obsolete /proc/ide/hd?/settings

Majority of these settings is also available through ioctls. We will deal with the rest during deprecation period.

Unfortunately while these changes are definitely a good thing.

Review

Quoted 4 lines
(quoted diff) +3 -0
+	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.

#2 lore raw
Quoted 7 lines · Alan Cox

Review

Quoted 3 lines
(quoted diff) +3 -0
+	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...

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 10 lines · Jens Axboe
Quoted 7 lines · Alan Cox

Review

Quoted 3 lines
(quoted diff) +3 -0
+   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

Quoted 10 lines · Jens Axboe
Quoted 7 lines · Alan Cox

Review

Quoted 3 lines
(quoted diff) +3 -0
+   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...

drivers/ide/ide-proc.c +15 -5
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
@@ -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;