diff options
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r-- | fs/ext2/super.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 6abaf75163f0..088b011bb97e 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -234,16 +234,16 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
234 | le16_to_cpu(es->s_def_resgid) != EXT2_DEF_RESGID) { | 234 | le16_to_cpu(es->s_def_resgid) != EXT2_DEF_RESGID) { |
235 | seq_printf(seq, ",resgid=%u", sbi->s_resgid); | 235 | seq_printf(seq, ",resgid=%u", sbi->s_resgid); |
236 | } | 236 | } |
237 | if (test_opt(sb, ERRORS_CONT)) { | 237 | if (test_opt(sb, ERRORS_RO)) { |
238 | int def_errors = le16_to_cpu(es->s_errors); | 238 | int def_errors = le16_to_cpu(es->s_errors); |
239 | 239 | ||
240 | if (def_errors == EXT2_ERRORS_PANIC || | 240 | if (def_errors == EXT2_ERRORS_PANIC || |
241 | def_errors == EXT2_ERRORS_RO) { | 241 | def_errors == EXT2_ERRORS_CONTINUE) { |
242 | seq_puts(seq, ",errors=continue"); | 242 | seq_puts(seq, ",errors=remount-ro"); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | if (test_opt(sb, ERRORS_RO)) | 245 | if (test_opt(sb, ERRORS_CONT)) |
246 | seq_puts(seq, ",errors=remount-ro"); | 246 | seq_puts(seq, ",errors=continue"); |
247 | if (test_opt(sb, ERRORS_PANIC)) | 247 | if (test_opt(sb, ERRORS_PANIC)) |
248 | seq_puts(seq, ",errors=panic"); | 248 | seq_puts(seq, ",errors=panic"); |
249 | if (test_opt(sb, NO_UID32)) | 249 | if (test_opt(sb, NO_UID32)) |
@@ -285,6 +285,9 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
285 | seq_puts(seq, ",xip"); | 285 | seq_puts(seq, ",xip"); |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | if (!test_opt(sb, RESERVATION)) | ||
289 | seq_puts(seq, ",noreservation"); | ||
290 | |||
288 | return 0; | 291 | return 0; |
289 | } | 292 | } |
290 | 293 | ||
@@ -296,7 +299,6 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *da | |||
296 | static const struct super_operations ext2_sops = { | 299 | static const struct super_operations ext2_sops = { |
297 | .alloc_inode = ext2_alloc_inode, | 300 | .alloc_inode = ext2_alloc_inode, |
298 | .destroy_inode = ext2_destroy_inode, | 301 | .destroy_inode = ext2_destroy_inode, |
299 | .read_inode = ext2_read_inode, | ||
300 | .write_inode = ext2_write_inode, | 302 | .write_inode = ext2_write_inode, |
301 | .delete_inode = ext2_delete_inode, | 303 | .delete_inode = ext2_delete_inode, |
302 | .put_super = ext2_put_super, | 304 | .put_super = ext2_put_super, |
@@ -326,11 +328,10 @@ static struct inode *ext2_nfs_get_inode(struct super_block *sb, | |||
326 | * it might be "neater" to call ext2_get_inode first and check | 328 | * it might be "neater" to call ext2_get_inode first and check |
327 | * if the inode is valid..... | 329 | * if the inode is valid..... |
328 | */ | 330 | */ |
329 | inode = iget(sb, ino); | 331 | inode = ext2_iget(sb, ino); |
330 | if (inode == NULL) | 332 | if (IS_ERR(inode)) |
331 | return ERR_PTR(-ENOMEM); | 333 | return ERR_CAST(inode); |
332 | if (is_bad_inode(inode) || | 334 | if (generation && inode->i_generation != generation) { |
333 | (generation && inode->i_generation != generation)) { | ||
334 | /* we didn't find the right inode.. */ | 335 | /* we didn't find the right inode.. */ |
335 | iput(inode); | 336 | iput(inode); |
336 | return ERR_PTR(-ESTALE); | 337 | return ERR_PTR(-ESTALE); |
@@ -617,27 +618,24 @@ static int ext2_setup_super (struct super_block * sb, | |||
617 | return res; | 618 | return res; |
618 | } | 619 | } |
619 | 620 | ||
620 | static int ext2_check_descriptors (struct super_block * sb) | 621 | static int ext2_check_descriptors(struct super_block *sb) |
621 | { | 622 | { |
622 | int i; | 623 | int i; |
623 | int desc_block = 0; | ||
624 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 624 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
625 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | 625 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); |
626 | unsigned long last_block; | 626 | unsigned long last_block; |
627 | struct ext2_group_desc * gdp = NULL; | ||
628 | 627 | ||
629 | ext2_debug ("Checking group descriptors"); | 628 | ext2_debug ("Checking group descriptors"); |
630 | 629 | ||
631 | for (i = 0; i < sbi->s_groups_count; i++) | 630 | for (i = 0; i < sbi->s_groups_count; i++) { |
632 | { | 631 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); |
632 | |||
633 | if (i == sbi->s_groups_count - 1) | 633 | if (i == sbi->s_groups_count - 1) |
634 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 634 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
635 | else | 635 | else |
636 | last_block = first_block + | 636 | last_block = first_block + |
637 | (EXT2_BLOCKS_PER_GROUP(sb) - 1); | 637 | (EXT2_BLOCKS_PER_GROUP(sb) - 1); |
638 | 638 | ||
639 | if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0) | ||
640 | gdp = (struct ext2_group_desc *) sbi->s_group_desc[desc_block++]->b_data; | ||
641 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || | 639 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || |
642 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) | 640 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) |
643 | { | 641 | { |
@@ -667,7 +665,6 @@ static int ext2_check_descriptors (struct super_block * sb) | |||
667 | return 0; | 665 | return 0; |
668 | } | 666 | } |
669 | first_block += EXT2_BLOCKS_PER_GROUP(sb); | 667 | first_block += EXT2_BLOCKS_PER_GROUP(sb); |
670 | gdp++; | ||
671 | } | 668 | } |
672 | return 1; | 669 | return 1; |
673 | } | 670 | } |
@@ -750,6 +747,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
750 | unsigned long logic_sb_block; | 747 | unsigned long logic_sb_block; |
751 | unsigned long offset = 0; | 748 | unsigned long offset = 0; |
752 | unsigned long def_mount_opts; | 749 | unsigned long def_mount_opts; |
750 | long ret = -EINVAL; | ||
753 | int blocksize = BLOCK_SIZE; | 751 | int blocksize = BLOCK_SIZE; |
754 | int db_count; | 752 | int db_count; |
755 | int i, j; | 753 | int i, j; |
@@ -820,10 +818,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
820 | 818 | ||
821 | if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) | 819 | if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) |
822 | set_opt(sbi->s_mount_opt, ERRORS_PANIC); | 820 | set_opt(sbi->s_mount_opt, ERRORS_PANIC); |
823 | else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_RO) | 821 | else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) |
824 | set_opt(sbi->s_mount_opt, ERRORS_RO); | ||
825 | else | ||
826 | set_opt(sbi->s_mount_opt, ERRORS_CONT); | 822 | set_opt(sbi->s_mount_opt, ERRORS_CONT); |
823 | else | ||
824 | set_opt(sbi->s_mount_opt, ERRORS_RO); | ||
827 | 825 | ||
828 | sbi->s_resuid = le16_to_cpu(es->s_def_resuid); | 826 | sbi->s_resuid = le16_to_cpu(es->s_def_resuid); |
829 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); | 827 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); |
@@ -868,8 +866,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
868 | 866 | ||
869 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | 867 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); |
870 | 868 | ||
871 | if ((ext2_use_xip(sb)) && ((blocksize != PAGE_SIZE) || | 869 | if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { |
872 | (sb->s_blocksize != blocksize))) { | ||
873 | if (!silent) | 870 | if (!silent) |
874 | printk("XIP: Unsupported blocksize\n"); | 871 | printk("XIP: Unsupported blocksize\n"); |
875 | goto failed_mount; | 872 | goto failed_mount; |
@@ -1046,19 +1043,24 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1046 | sb->s_op = &ext2_sops; | 1043 | sb->s_op = &ext2_sops; |
1047 | sb->s_export_op = &ext2_export_ops; | 1044 | sb->s_export_op = &ext2_export_ops; |
1048 | sb->s_xattr = ext2_xattr_handlers; | 1045 | sb->s_xattr = ext2_xattr_handlers; |
1049 | root = iget(sb, EXT2_ROOT_INO); | 1046 | root = ext2_iget(sb, EXT2_ROOT_INO); |
1050 | sb->s_root = d_alloc_root(root); | 1047 | if (IS_ERR(root)) { |
1051 | if (!sb->s_root) { | 1048 | ret = PTR_ERR(root); |
1052 | iput(root); | ||
1053 | printk(KERN_ERR "EXT2-fs: get root inode failed\n"); | ||
1054 | goto failed_mount3; | 1049 | goto failed_mount3; |
1055 | } | 1050 | } |
1056 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 1051 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
1057 | dput(sb->s_root); | 1052 | iput(root); |
1058 | sb->s_root = NULL; | ||
1059 | printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); | 1053 | printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); |
1060 | goto failed_mount3; | 1054 | goto failed_mount3; |
1061 | } | 1055 | } |
1056 | |||
1057 | sb->s_root = d_alloc_root(root); | ||
1058 | if (!sb->s_root) { | ||
1059 | iput(root); | ||
1060 | printk(KERN_ERR "EXT2-fs: get root inode failed\n"); | ||
1061 | ret = -ENOMEM; | ||
1062 | goto failed_mount3; | ||
1063 | } | ||
1062 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 1064 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
1063 | ext2_warning(sb, __FUNCTION__, | 1065 | ext2_warning(sb, __FUNCTION__, |
1064 | "mounting ext3 filesystem as ext2"); | 1066 | "mounting ext3 filesystem as ext2"); |
@@ -1085,7 +1087,7 @@ failed_mount: | |||
1085 | failed_sbi: | 1087 | failed_sbi: |
1086 | sb->s_fs_info = NULL; | 1088 | sb->s_fs_info = NULL; |
1087 | kfree(sbi); | 1089 | kfree(sbi); |
1088 | return -EINVAL; | 1090 | return ret; |
1089 | } | 1091 | } |
1090 | 1092 | ||
1091 | static void ext2_commit_super (struct super_block * sb, | 1093 | static void ext2_commit_super (struct super_block * sb, |