aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2011-04-05 19:55:28 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-04-05 19:55:28 -0400
commit0449641130f5652b344ef6fa39fa019d7e94660a (patch)
treed24779d75a6d3fafff8082591b3572a5fdb32858 /fs
parent6cba611e600ded15f642552ce6b5f7ee243bacf0 (diff)
ext4: init timer earlier to avoid a kernel panic in __save_error_info
During mount, when we fail to open journal inode or root inode, the __save_error_info will mod_timer. But actually s_err_report isn't initialized yet and the kernel oops. The detailed information can be found https://bugzilla.kernel.org/show_bug.cgi?id=32082. The best way is to check whether the timer s_err_report is initialized or not. But it seems that in include/linux/timer.h, we can't find a good function to check the status of this timer, so this patch just move the initializtion of s_err_report earlier so that we can avoid the kernel panic. The corresponding del_timer is also added in the error path. Reported-by: Sami Liedes <sliedes@cc.hut.fi> Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 35bd0206bbb3..551cb8e2110c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3391,6 +3391,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3391 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 3391 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
3392 spin_lock_init(&sbi->s_next_gen_lock); 3392 spin_lock_init(&sbi->s_next_gen_lock);
3393 3393
3394 init_timer(&sbi->s_err_report);
3395 sbi->s_err_report.function = print_daily_error_info;
3396 sbi->s_err_report.data = (unsigned long) sb;
3397
3394 err = percpu_counter_init(&sbi->s_freeblocks_counter, 3398 err = percpu_counter_init(&sbi->s_freeblocks_counter,
3395 ext4_count_free_blocks(sb)); 3399 ext4_count_free_blocks(sb));
3396 if (!err) { 3400 if (!err) {
@@ -3652,9 +3656,6 @@ no_journal:
3652 "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, 3656 "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts,
3653 *sbi->s_es->s_mount_opts ? "; " : "", orig_data); 3657 *sbi->s_es->s_mount_opts ? "; " : "", orig_data);
3654 3658
3655 init_timer(&sbi->s_err_report);
3656 sbi->s_err_report.function = print_daily_error_info;
3657 sbi->s_err_report.data = (unsigned long) sb;
3658 if (es->s_error_count) 3659 if (es->s_error_count)
3659 mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ 3660 mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */
3660 3661
@@ -3678,6 +3679,7 @@ failed_mount_wq:
3678 sbi->s_journal = NULL; 3679 sbi->s_journal = NULL;
3679 } 3680 }
3680failed_mount3: 3681failed_mount3:
3682 del_timer(&sbi->s_err_report);
3681 if (sbi->s_flex_groups) { 3683 if (sbi->s_flex_groups) {
3682 if (is_vmalloc_addr(sbi->s_flex_groups)) 3684 if (is_vmalloc_addr(sbi->s_flex_groups))
3683 vfree(sbi->s_flex_groups); 3685 vfree(sbi->s_flex_groups);