aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2013-07-11 22:42:42 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-07-11 22:42:42 -0400
commite8974c3930ae9692bb4f77380961421e9a2f76ab (patch)
treeecb1a3a41d4804a83daa8b2da77cead5c6f732c9
parentad065dd01662ae22138899e6b1c8eeb3a529964f (diff)
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 <anatol.pomozov@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/page-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index d63cc5e9d3b5..6625d210fb45 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -25,6 +25,7 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/ratelimit.h>
28 29
29#include "ext4_jbd2.h" 30#include "ext4_jbd2.h"
30#include "xattr.h" 31#include "xattr.h"
@@ -55,7 +56,7 @@ void ext4_exit_pageio(void)
55static void buffer_io_error(struct buffer_head *bh) 56static void buffer_io_error(struct buffer_head *bh)
56{ 57{
57 char b[BDEVNAME_SIZE]; 58 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",
59 bdevname(bh->b_bdev, b), 60 bdevname(bh->b_bdev, b),
60 (unsigned long long)bh->b_blocknr); 61 (unsigned long long)bh->b_blocknr);
61} 62}