aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>2008-10-18 23:27:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:37 -0400
commit0e4fb5e283870757024294bc4567a7c59d936f0b (patch)
tree162263fe9e712124d3df886ca57d8db752a3237d /fs/ext3
parent46d01a225e694f1a4343beea44f1e85105aedd7e (diff)
ext3: add an option to control error handling on file data
If the journal doesn't abort when it gets an IO error in file data blocks, the file data corruption will spread silently. Because most of applications and commands do buffered writes without fsync(), they don't notice the IO error. It's scary for mission critical systems. On the other hand, if the journal aborts whenever it gets an IO error in file data blocks, the system will easily become inoperable. So this patch introduces a filesystem option to determine whether it aborts the journal or just call printk() when it gets an IO error in file data. If you mount a ext3 fs with data_err=abort option, it aborts on file data write error. If you mount it with data_err=ignore, it doesn't abort, just call printk(). data_err=ignore is the default. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Cc: Jan Kara <jack@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/super.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 399a96a6c556..3a260af5544d 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -625,6 +625,9 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
625 else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) 625 else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)
626 seq_puts(seq, ",data=writeback"); 626 seq_puts(seq, ",data=writeback");
627 627
628 if (test_opt(sb, DATA_ERR_ABORT))
629 seq_puts(seq, ",data_err=abort");
630
628 ext3_show_quota_options(seq, sb); 631 ext3_show_quota_options(seq, sb);
629 632
630 return 0; 633 return 0;
@@ -754,6 +757,7 @@ enum {
754 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh, 757 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh,
755 Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev, 758 Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev,
756 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, 759 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
760 Opt_data_err_abort, Opt_data_err_ignore,
757 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 761 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
758 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, 762 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
759 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, 763 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
@@ -796,6 +800,8 @@ static const match_table_t tokens = {
796 {Opt_data_journal, "data=journal"}, 800 {Opt_data_journal, "data=journal"},
797 {Opt_data_ordered, "data=ordered"}, 801 {Opt_data_ordered, "data=ordered"},
798 {Opt_data_writeback, "data=writeback"}, 802 {Opt_data_writeback, "data=writeback"},
803 {Opt_data_err_abort, "data_err=abort"},
804 {Opt_data_err_ignore, "data_err=ignore"},
799 {Opt_offusrjquota, "usrjquota="}, 805 {Opt_offusrjquota, "usrjquota="},
800 {Opt_usrjquota, "usrjquota=%s"}, 806 {Opt_usrjquota, "usrjquota=%s"},
801 {Opt_offgrpjquota, "grpjquota="}, 807 {Opt_offgrpjquota, "grpjquota="},
@@ -1011,6 +1017,12 @@ static int parse_options (char *options, struct super_block *sb,
1011 sbi->s_mount_opt |= data_opt; 1017 sbi->s_mount_opt |= data_opt;
1012 } 1018 }
1013 break; 1019 break;
1020 case Opt_data_err_abort:
1021 set_opt(sbi->s_mount_opt, DATA_ERR_ABORT);
1022 break;
1023 case Opt_data_err_ignore:
1024 clear_opt(sbi->s_mount_opt, DATA_ERR_ABORT);
1025 break;
1014#ifdef CONFIG_QUOTA 1026#ifdef CONFIG_QUOTA
1015 case Opt_usrjquota: 1027 case Opt_usrjquota:
1016 qtype = USRQUOTA; 1028 qtype = USRQUOTA;
@@ -1986,6 +1998,10 @@ static void ext3_init_journal_params(struct super_block *sb, journal_t *journal)
1986 journal->j_flags |= JFS_BARRIER; 1998 journal->j_flags |= JFS_BARRIER;
1987 else 1999 else
1988 journal->j_flags &= ~JFS_BARRIER; 2000 journal->j_flags &= ~JFS_BARRIER;
2001 if (test_opt(sb, DATA_ERR_ABORT))
2002 journal->j_flags |= JFS_ABORT_ON_SYNCDATA_ERR;
2003 else
2004 journal->j_flags &= ~JFS_ABORT_ON_SYNCDATA_ERR;
1989 spin_unlock(&journal->j_state_lock); 2005 spin_unlock(&journal->j_state_lock);
1990} 2006}
1991 2007