diff options
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r-- | fs/ext3/super.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index ad5360664082..fe3119a71ada 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -84,7 +84,7 @@ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) | |||
84 | * take the FS itself readonly cleanly. */ | 84 | * take the FS itself readonly cleanly. */ |
85 | journal = EXT3_SB(sb)->s_journal; | 85 | journal = EXT3_SB(sb)->s_journal; |
86 | if (is_journal_aborted(journal)) { | 86 | if (is_journal_aborted(journal)) { |
87 | ext3_abort(sb, __FUNCTION__, | 87 | ext3_abort(sb, __func__, |
88 | "Detected aborted journal"); | 88 | "Detected aborted journal"); |
89 | return ERR_PTR(-EROFS); | 89 | return ERR_PTR(-EROFS); |
90 | } | 90 | } |
@@ -304,7 +304,7 @@ void ext3_update_dynamic_rev(struct super_block *sb) | |||
304 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) | 304 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) |
305 | return; | 305 | return; |
306 | 306 | ||
307 | ext3_warning(sb, __FUNCTION__, | 307 | ext3_warning(sb, __func__, |
308 | "updating to rev %d because of new feature flag, " | 308 | "updating to rev %d because of new feature flag, " |
309 | "running e2fsck is recommended", | 309 | "running e2fsck is recommended", |
310 | EXT3_DYNAMIC_REV); | 310 | EXT3_DYNAMIC_REV); |
@@ -685,7 +685,8 @@ static int ext3_acquire_dquot(struct dquot *dquot); | |||
685 | static int ext3_release_dquot(struct dquot *dquot); | 685 | static int ext3_release_dquot(struct dquot *dquot); |
686 | static int ext3_mark_dquot_dirty(struct dquot *dquot); | 686 | static int ext3_mark_dquot_dirty(struct dquot *dquot); |
687 | static int ext3_write_info(struct super_block *sb, int type); | 687 | static int ext3_write_info(struct super_block *sb, int type); |
688 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path); | 688 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, |
689 | char *path, int remount); | ||
689 | static int ext3_quota_on_mount(struct super_block *sb, int type); | 690 | static int ext3_quota_on_mount(struct super_block *sb, int type); |
690 | static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, | 691 | static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, |
691 | size_t len, loff_t off); | 692 | size_t len, loff_t off); |
@@ -1096,6 +1097,9 @@ clear_qf_name: | |||
1096 | case Opt_quota: | 1097 | case Opt_quota: |
1097 | case Opt_usrquota: | 1098 | case Opt_usrquota: |
1098 | case Opt_grpquota: | 1099 | case Opt_grpquota: |
1100 | printk(KERN_ERR | ||
1101 | "EXT3-fs: quota options not supported.\n"); | ||
1102 | break; | ||
1099 | case Opt_usrjquota: | 1103 | case Opt_usrjquota: |
1100 | case Opt_grpjquota: | 1104 | case Opt_grpjquota: |
1101 | case Opt_offusrjquota: | 1105 | case Opt_offusrjquota: |
@@ -1103,7 +1107,7 @@ clear_qf_name: | |||
1103 | case Opt_jqfmt_vfsold: | 1107 | case Opt_jqfmt_vfsold: |
1104 | case Opt_jqfmt_vfsv0: | 1108 | case Opt_jqfmt_vfsv0: |
1105 | printk(KERN_ERR | 1109 | printk(KERN_ERR |
1106 | "EXT3-fs: journalled quota options not " | 1110 | "EXT3-fs: journaled quota options not " |
1107 | "supported.\n"); | 1111 | "supported.\n"); |
1108 | break; | 1112 | break; |
1109 | case Opt_noquota: | 1113 | case Opt_noquota: |
@@ -1218,7 +1222,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1218 | inconsistencies, to force a fsck at reboot. But for | 1222 | inconsistencies, to force a fsck at reboot. But for |
1219 | a plain journaled filesystem we can keep it set as | 1223 | a plain journaled filesystem we can keep it set as |
1220 | valid forever! :) */ | 1224 | valid forever! :) */ |
1221 | es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS); | 1225 | es->s_state &= cpu_to_le16(~EXT3_VALID_FS); |
1222 | #endif | 1226 | #endif |
1223 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) | 1227 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) |
1224 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); | 1228 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); |
@@ -1253,14 +1257,14 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1253 | static int ext3_check_descriptors(struct super_block *sb) | 1257 | static int ext3_check_descriptors(struct super_block *sb) |
1254 | { | 1258 | { |
1255 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 1259 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
1256 | ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
1257 | ext3_fsblk_t last_block; | ||
1258 | int i; | 1260 | int i; |
1259 | 1261 | ||
1260 | ext3_debug ("Checking group descriptors"); | 1262 | ext3_debug ("Checking group descriptors"); |
1261 | 1263 | ||
1262 | for (i = 0; i < sbi->s_groups_count; i++) { | 1264 | for (i = 0; i < sbi->s_groups_count; i++) { |
1263 | struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); | 1265 | struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); |
1266 | ext3_fsblk_t first_block = ext3_group_first_block_no(sb, i); | ||
1267 | ext3_fsblk_t last_block; | ||
1264 | 1268 | ||
1265 | if (i == sbi->s_groups_count - 1) | 1269 | if (i == sbi->s_groups_count - 1) |
1266 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 1270 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
@@ -1299,7 +1303,6 @@ static int ext3_check_descriptors(struct super_block *sb) | |||
1299 | le32_to_cpu(gdp->bg_inode_table)); | 1303 | le32_to_cpu(gdp->bg_inode_table)); |
1300 | return 0; | 1304 | return 0; |
1301 | } | 1305 | } |
1302 | first_block += EXT3_BLOCKS_PER_GROUP(sb); | ||
1303 | } | 1306 | } |
1304 | 1307 | ||
1305 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); | 1308 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); |
@@ -1387,7 +1390,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1387 | if (inode->i_nlink) { | 1390 | if (inode->i_nlink) { |
1388 | printk(KERN_DEBUG | 1391 | printk(KERN_DEBUG |
1389 | "%s: truncating inode %lu to %Ld bytes\n", | 1392 | "%s: truncating inode %lu to %Ld bytes\n", |
1390 | __FUNCTION__, inode->i_ino, inode->i_size); | 1393 | __func__, inode->i_ino, inode->i_size); |
1391 | jbd_debug(2, "truncating inode %lu to %Ld bytes\n", | 1394 | jbd_debug(2, "truncating inode %lu to %Ld bytes\n", |
1392 | inode->i_ino, inode->i_size); | 1395 | inode->i_ino, inode->i_size); |
1393 | ext3_truncate(inode); | 1396 | ext3_truncate(inode); |
@@ -1395,7 +1398,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1395 | } else { | 1398 | } else { |
1396 | printk(KERN_DEBUG | 1399 | printk(KERN_DEBUG |
1397 | "%s: deleting unreferenced inode %lu\n", | 1400 | "%s: deleting unreferenced inode %lu\n", |
1398 | __FUNCTION__, inode->i_ino); | 1401 | __func__, inode->i_ino); |
1399 | jbd_debug(2, "deleting unreferenced inode %lu\n", | 1402 | jbd_debug(2, "deleting unreferenced inode %lu\n", |
1400 | inode->i_ino); | 1403 | inode->i_ino); |
1401 | nr_orphans++; | 1404 | nr_orphans++; |
@@ -1415,7 +1418,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1415 | /* Turn quotas off */ | 1418 | /* Turn quotas off */ |
1416 | for (i = 0; i < MAXQUOTAS; i++) { | 1419 | for (i = 0; i < MAXQUOTAS; i++) { |
1417 | if (sb_dqopt(sb)->files[i]) | 1420 | if (sb_dqopt(sb)->files[i]) |
1418 | vfs_quota_off(sb, i); | 1421 | vfs_quota_off(sb, i, 0); |
1419 | } | 1422 | } |
1420 | #endif | 1423 | #endif |
1421 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ | 1424 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ |
@@ -2298,9 +2301,9 @@ static void ext3_clear_journal_err(struct super_block * sb, | |||
2298 | char nbuf[16]; | 2301 | char nbuf[16]; |
2299 | 2302 | ||
2300 | errstr = ext3_decode_error(sb, j_errno, nbuf); | 2303 | errstr = ext3_decode_error(sb, j_errno, nbuf); |
2301 | ext3_warning(sb, __FUNCTION__, "Filesystem error recorded " | 2304 | ext3_warning(sb, __func__, "Filesystem error recorded " |
2302 | "from previous mount: %s", errstr); | 2305 | "from previous mount: %s", errstr); |
2303 | ext3_warning(sb, __FUNCTION__, "Marking fs in need of " | 2306 | ext3_warning(sb, __func__, "Marking fs in need of " |
2304 | "filesystem check."); | 2307 | "filesystem check."); |
2305 | 2308 | ||
2306 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; | 2309 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; |
@@ -2427,7 +2430,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2427 | } | 2430 | } |
2428 | 2431 | ||
2429 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) | 2432 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) |
2430 | ext3_abort(sb, __FUNCTION__, "Abort forced by user"); | 2433 | ext3_abort(sb, __func__, "Abort forced by user"); |
2431 | 2434 | ||
2432 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 2435 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
2433 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 2436 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); |
@@ -2639,8 +2642,14 @@ static int ext3_dquot_drop(struct inode *inode) | |||
2639 | 2642 | ||
2640 | /* We may delete quota structure so we need to reserve enough blocks */ | 2643 | /* We may delete quota structure so we need to reserve enough blocks */ |
2641 | handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)); | 2644 | handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)); |
2642 | if (IS_ERR(handle)) | 2645 | if (IS_ERR(handle)) { |
2646 | /* | ||
2647 | * We call dquot_drop() anyway to at least release references | ||
2648 | * to quota structures so that umount does not hang. | ||
2649 | */ | ||
2650 | dquot_drop(inode); | ||
2643 | return PTR_ERR(handle); | 2651 | return PTR_ERR(handle); |
2652 | } | ||
2644 | ret = dquot_drop(inode); | 2653 | ret = dquot_drop(inode); |
2645 | err = ext3_journal_stop(handle); | 2654 | err = ext3_journal_stop(handle); |
2646 | if (!ret) | 2655 | if (!ret) |
@@ -2743,17 +2752,17 @@ static int ext3_quota_on_mount(struct super_block *sb, int type) | |||
2743 | * Standard function to be called on quota_on | 2752 | * Standard function to be called on quota_on |
2744 | */ | 2753 | */ |
2745 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, | 2754 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, |
2746 | char *path) | 2755 | char *path, int remount) |
2747 | { | 2756 | { |
2748 | int err; | 2757 | int err; |
2749 | struct nameidata nd; | 2758 | struct nameidata nd; |
2750 | 2759 | ||
2751 | if (!test_opt(sb, QUOTA)) | 2760 | if (!test_opt(sb, QUOTA)) |
2752 | return -EINVAL; | 2761 | return -EINVAL; |
2753 | /* Not journalling quota? */ | 2762 | /* Not journalling quota or remount? */ |
2754 | if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] && | 2763 | if ((!EXT3_SB(sb)->s_qf_names[USRQUOTA] && |
2755 | !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) | 2764 | !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) || remount) |
2756 | return vfs_quota_on(sb, type, format_id, path); | 2765 | return vfs_quota_on(sb, type, format_id, path, remount); |
2757 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 2766 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
2758 | if (err) | 2767 | if (err) |
2759 | return err; | 2768 | return err; |
@@ -2762,13 +2771,13 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
2762 | path_put(&nd.path); | 2771 | path_put(&nd.path); |
2763 | return -EXDEV; | 2772 | return -EXDEV; |
2764 | } | 2773 | } |
2765 | /* Quotafile not of fs root? */ | 2774 | /* Quotafile not in fs root? */ |
2766 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) | 2775 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
2767 | printk(KERN_WARNING | 2776 | printk(KERN_WARNING |
2768 | "EXT3-fs: Quota file not on filesystem root. " | 2777 | "EXT3-fs: Quota file not on filesystem root. " |
2769 | "Journalled quota will not work.\n"); | 2778 | "Journalled quota will not work.\n"); |
2770 | path_put(&nd.path); | 2779 | path_put(&nd.path); |
2771 | return vfs_quota_on(sb, type, format_id, path); | 2780 | return vfs_quota_on(sb, type, format_id, path, remount); |
2772 | } | 2781 | } |
2773 | 2782 | ||
2774 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | 2783 | /* Read data from quotafile - avoid pagecache and such because we cannot afford |