fs: fat: rate limit the kernel messages
If FAT formatted SD card gets removed without unmounting,
FAT file system may throw many kernel error messages which
could too much traffic for console driver and can sometimes
even cause the system to trigger watchdog timeout.
This patch converts the printk to printk_ratelimited to rate
limit the error messages from FAT fs.
Change-Id: I58b942f6714a8d3353478eb21139b8046ee3f875
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 6d93360..a1d192d 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -56,7 +56,11 @@
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
+ if (!strncmp(level, KERN_ERR, sizeof(KERN_ERR)))
+ printk_ratelimited("%sFAT-fs (%s): %pV\n", level,
+ sb->s_id, &vaf);
+ else
+ printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
va_end(args);
}