1 ext4: add option for squelching ext4 errors to prevent dmesg from filling up
3 Only print one error per inode; this is enough to know that something
4 is wrong with an inode, without filling dmesg by spamming the system
5 with messages over and over again.
7 This is enabled via sysfs option, which is currently off by default.
8 Some environments may want to turn this on by default. Eventually we
9 may want to make this be something which is tunable by a superblock
12 Addresses-Google-Bug: #2507977
14 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 fs/ext4/super.c | 2 ++
18 2 files changed, 4 insertions(+)
20 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
21 index 953f504..d0be35a 100644
24 @@ -1158,6 +1158,7 @@ struct ext4_super_block {
26 #define EXT4_MF_MNTDIR_SAMPLED 0x0001
27 #define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
28 +#define EXT4_MF_FS_SQUELCH 0x0004 /* Squelch file system errors */
31 * fourth extended-fs super-block data in memory
32 @@ -1389,6 +1390,7 @@ enum {
33 EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */
34 EXT4_STATE_ORDERED_MODE, /* data=ordered mode */
35 EXT4_STATE_EXT_PRECACHED, /* extents have been precached */
36 + EXT4_STATE_ERR_SQUELCHED, /* squeched error */
39 #define EXT4_INODE_BIT_FNS(name, field, offset) \
40 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
41 index d31aea2..19ae2f9 100644
44 @@ -2670,6 +2670,7 @@ EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
45 EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128);
46 EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
47 EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error);
48 +EXT4_RW_ATTR_SBI_BOOL(squelch_errors, s_mount_flags, EXT4_MF_FS_SQUELCH);
50 static struct attribute *ext4_attrs[] = {
51 ATTR_LIST(delayed_allocation_blocks),
52 @@ -2687,6 +2688,7 @@ static struct attribute *ext4_attrs[] = {
53 ATTR_LIST(max_writeback_mb_bump),
54 ATTR_LIST(extent_max_zeroout_kb),
55 ATTR_LIST(trigger_fs_error),
56 + ATTR_LIST(squelch_errors),