Skip to content

Commit e8974c3

Browse files
anatoltytso
authored andcommitted
ext4: rate limit printk in buffer_io_error()
If there are a lot of outstanding buffered IOs when a device is taken offline (due to hardware errors etc), ext4_end_bio prints out a message for each failed logical block. While this is desirable, we see thousands of such lines being printed out before the serial console gets overwhelmed, causing ext4_end_bio() wait for the printk to complete. This in itself isn't a disaster, except for the detail that this function is being called with the queue lock held. This causes any other function in the block layer to spin on its spin_lock_irqsave while the serial console is draining. If NMI watchdog is enabled on this machine then it eventually comes along and shoots the machine in the head. The end result is that losing any one disk causes the machine to go down. This patch rate limits the printk to bandaid around the problem. Tested: xfstests Change-Id: I8ab5690dcf4f3a67e78be147d45e489fdf4a88d8 Signed-off-by: Anatol Pomozov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent ad065dd commit e8974c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext4/page-io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/kernel.h>
2626
#include <linux/slab.h>
2727
#include <linux/mm.h>
28+
#include <linux/ratelimit.h>
2829

2930
#include "ext4_jbd2.h"
3031
#include "xattr.h"
@@ -55,7 +56,7 @@ void ext4_exit_pageio(void)
5556
static void buffer_io_error(struct buffer_head *bh)
5657
{
5758
char b[BDEVNAME_SIZE];
58-
printk(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n",
59+
printk_ratelimited(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n",
5960
bdevname(bh->b_bdev, b),
6061
(unsigned long long)bh->b_blocknr);
6162
}

0 commit comments

Comments
 (0)