Skip to content

Commit d7f0ce4

Browse files
committed
inotify: do not spam console without limit
inotify was supposed to have a dmesg printk ratelimitor which would cause inotify to only emit one message per boot. The static bool was never set so it kept firing messages. This patch correctly limits warnings in multiple places. Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 2dfc1ca commit d7f0ce4

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎fs/notify/inotify/inotify_user.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,20 +449,18 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
449449
* if it wasn't....
450450
*/
451451
if (wd == -1) {
452-
printk(KERN_WARNING "%s: ientry=%p ientry->wd=%d ientry->group=%p"
452+
WARN_ONCE(1, "%s: ientry=%p ientry->wd=%d ientry->group=%p"
453453
" ientry->inode=%p\n", __func__, ientry, ientry->wd,
454454
ientry->fsn_entry.group, ientry->fsn_entry.inode);
455-
WARN_ON(1);
456455
goto out;
457456
}
458457

459458
/* Lets look in the idr to see if we find it */
460459
found_ientry = inotify_idr_find_locked(group, wd);
461460
if (unlikely(!found_ientry)) {
462-
printk(KERN_WARNING "%s: ientry=%p ientry->wd=%d ientry->group=%p"
461+
WARN_ONCE(1, "%s: ientry=%p ientry->wd=%d ientry->group=%p"
463462
" ientry->inode=%p\n", __func__, ientry, ientry->wd,
464463
ientry->fsn_entry.group, ientry->fsn_entry.inode);
465-
WARN_ON(1);
466464
goto out;
467465
}
468466

@@ -472,8 +470,7 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
472470
* fucked up somewhere.
473471
*/
474472
if (unlikely(found_ientry != ientry)) {
475-
WARN_ON(1);
476-
printk(KERN_WARNING "%s: ientry=%p ientry->wd=%d ientry->group=%p "
473+
WARN_ONCE(1, "%s: ientry=%p ientry->wd=%d ientry->group=%p "
477474
"entry->inode=%p found_ientry=%p found_ientry->wd=%d "
478475
"found_ientry->group=%p found_ientry->inode=%p\n",
479476
__func__, ientry, ientry->wd, ientry->fsn_entry.group,
@@ -489,7 +486,7 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
489486
* one ref grabbed by inotify_idr_find
490487
*/
491488
if (unlikely(atomic_read(&ientry->fsn_entry.refcnt) < 3)) {
492-
printk(KERN_WARNING "%s: ientry=%p ientry->wd=%d ientry->group=%p"
489+
printk(KERN_ERR "%s: ientry=%p ientry->wd=%d ientry->group=%p"
493490
" ientry->inode=%p\n", __func__, ientry, ientry->wd,
494491
ientry->fsn_entry.group, ientry->fsn_entry.inode);
495492
/* we can't really recover with bad ref cnting.. */

0 commit comments

Comments
 (0)