aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/inode.c
diff options
context:
space:
mode:
authorDenis Karpov <ext-denis.2.karpov@nokia.com>2009-06-03 13:34:22 -0400
committerOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2009-06-03 13:34:51 -0400
commit85c7859190c4197a7c34066db14c25903c401187 (patch)
tree9cf54e894f52eb1edfd35daeff66bfb5697b8360 /fs/fat/inode.c
parent9fa7eb283c5cdc2b0f4a8cfe6387ed82e5e9a3d3 (diff)
FAT: add 'errors' mount option
On severe errors FAT remounts itself in read-only mode. Allow to specify FAT fs desired behavior through 'errors' mount option: panic, continue or remount read-only. `mount -t [fat|vfat] -o errors=[panic,remount-ro,continue] \ <bdev> <mount point>` This is analog to ext2 fs 'errors' mount option. Signed-off-by: Denis Karpov <ext-denis.2.karpov@nokia.com> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r--fs/fat/inode.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 296785a0dec8..2b9052265e3e 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -76,7 +76,7 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock,
76 return 0; 76 return 0;
77 77
78 if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) { 78 if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) {
79 fat_fs_panic(sb, "corrupted file size (i_pos %lld, %lld)", 79 fat_fs_error(sb, "corrupted file size (i_pos %lld, %lld)",
80 MSDOS_I(inode)->i_pos, MSDOS_I(inode)->mmu_private); 80 MSDOS_I(inode)->i_pos, MSDOS_I(inode)->mmu_private);
81 return -EIO; 81 return -EIO;
82 } 82 }
@@ -834,6 +834,12 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
834 seq_puts(m, ",flush"); 834 seq_puts(m, ",flush");
835 if (opts->tz_utc) 835 if (opts->tz_utc)
836 seq_puts(m, ",tz=UTC"); 836 seq_puts(m, ",tz=UTC");
837 if (opts->errors == FAT_ERRORS_CONT)
838 seq_puts(m, ",errors=continue");
839 else if (opts->errors == FAT_ERRORS_PANIC)
840 seq_puts(m, ",errors=panic");
841 else
842 seq_puts(m, ",errors=remount-ro");
837 843
838 return 0; 844 return 0;
839} 845}
@@ -846,7 +852,8 @@ enum {
846 Opt_charset, Opt_shortname_lower, Opt_shortname_win95, 852 Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
847 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, 853 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
848 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, 854 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
849 Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err, 855 Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont,
856 Opt_err_panic, Opt_err_ro, Opt_err,
850}; 857};
851 858
852static const match_table_t fat_tokens = { 859static const match_table_t fat_tokens = {
@@ -869,6 +876,11 @@ static const match_table_t fat_tokens = {
869 {Opt_showexec, "showexec"}, 876 {Opt_showexec, "showexec"},
870 {Opt_debug, "debug"}, 877 {Opt_debug, "debug"},
871 {Opt_immutable, "sys_immutable"}, 878 {Opt_immutable, "sys_immutable"},
879 {Opt_flush, "flush"},
880 {Opt_tz_utc, "tz=UTC"},
881 {Opt_err_cont, "errors=continue"},
882 {Opt_err_panic, "errors=panic"},
883 {Opt_err_ro, "errors=remount-ro"},
872 {Opt_obsolate, "conv=binary"}, 884 {Opt_obsolate, "conv=binary"},
873 {Opt_obsolate, "conv=text"}, 885 {Opt_obsolate, "conv=text"},
874 {Opt_obsolate, "conv=auto"}, 886 {Opt_obsolate, "conv=auto"},
@@ -880,8 +892,6 @@ static const match_table_t fat_tokens = {
880 {Opt_obsolate, "cvf_format=%20s"}, 892 {Opt_obsolate, "cvf_format=%20s"},
881 {Opt_obsolate, "cvf_options=%100s"}, 893 {Opt_obsolate, "cvf_options=%100s"},
882 {Opt_obsolate, "posix"}, 894 {Opt_obsolate, "posix"},
883 {Opt_flush, "flush"},
884 {Opt_tz_utc, "tz=UTC"},
885 {Opt_err, NULL}, 895 {Opt_err, NULL},
886}; 896};
887static const match_table_t msdos_tokens = { 897static const match_table_t msdos_tokens = {
@@ -951,6 +961,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
951 opts->numtail = 1; 961 opts->numtail = 1;
952 opts->usefree = opts->nocase = 0; 962 opts->usefree = opts->nocase = 0;
953 opts->tz_utc = 0; 963 opts->tz_utc = 0;
964 opts->errors = FAT_ERRORS_RO;
954 *debug = 0; 965 *debug = 0;
955 966
956 if (!options) 967 if (!options)
@@ -1043,6 +1054,15 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
1043 case Opt_tz_utc: 1054 case Opt_tz_utc:
1044 opts->tz_utc = 1; 1055 opts->tz_utc = 1;
1045 break; 1056 break;
1057 case Opt_err_cont:
1058 opts->errors = FAT_ERRORS_CONT;
1059 break;
1060 case Opt_err_panic:
1061 opts->errors = FAT_ERRORS_PANIC;
1062 break;
1063 case Opt_err_ro:
1064 opts->errors = FAT_ERRORS_RO;
1065 break;
1046 1066
1047 /* msdos specific */ 1067 /* msdos specific */
1048 case Opt_dots: 1068 case Opt_dots: