}
if (retval) {
com_err("release_inode_blocks", retval,
- _("while calling ext2fs_adjust_ea_refocunt for inode %d"),
+ _("while calling ext2fs_adjust_ea_refcount for inode %d"),
ino);
return 1;
}
if (!inode.i_links_count) {
ext2fs_inode_alloc_stats2(fs, ino, -1,
LINUX_S_ISDIR(inode.i_mode));
- inode.i_dtime = time(0);
+ inode.i_dtime = ctx->now;
} else {
inode.i_dtime = 0;
}
}
}
- /* Read the resizde inode */
+ /* Read the resize inode */
pctx.ino = EXT2_RESIZE_INO;
retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
if (retval) {
* Verify the group descriptors....
*/
first_block = sb->s_first_data_block;
- last_block = first_block + blocks_per_group;
for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
pctx.group = i;
-
- if (i == fs->group_desc_count - 1)
- last_block = sb->s_blocks_count;
+
+ first_block = ext2fs_group_first_block(fs, i);
+ last_block = ext2fs_group_last_block(fs, i);
+
if ((gd->bg_block_bitmap < first_block) ||
- (gd->bg_block_bitmap >= last_block)) {
+ (gd->bg_block_bitmap > last_block)) {
pctx.blk = gd->bg_block_bitmap;
if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx))
gd->bg_block_bitmap = 0;
ctx->invalid_bitmaps++;
}
if ((gd->bg_inode_bitmap < first_block) ||
- (gd->bg_inode_bitmap >= last_block)) {
+ (gd->bg_inode_bitmap > last_block)) {
pctx.blk = gd->bg_inode_bitmap;
if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx))
gd->bg_inode_bitmap = 0;
}
if ((gd->bg_inode_table < first_block) ||
((gd->bg_inode_table +
- fs->inode_blocks_per_group - 1) >= last_block)) {
+ fs->inode_blocks_per_group - 1) > last_block)) {
pctx.blk = gd->bg_inode_table;
if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx))
gd->bg_inode_table = 0;
}
free_blocks += gd->bg_free_blocks_count;
free_inodes += gd->bg_free_inodes_count;
- first_block += sb->s_blocks_per_group;
- last_block += sb->s_blocks_per_group;
if ((gd->bg_free_blocks_count > sb->s_blocks_per_group) ||
(gd->bg_free_inodes_count > sb->s_inodes_per_group) ||
ext2fs_mark_super_dirty(fs);
}
+ /*
+ * Check to see if the superblock last mount time or last
+ * write time is in the future.
+ */
+ if (fs->super->s_mtime > ctx->now) {
+ pctx.num = fs->super->s_mtime;
+ if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_MOUNT, &pctx)) {
+ fs->super->s_mtime = ctx->now;
+ ext2fs_mark_super_dirty(fs);
+ }
+ }
+ if (fs->super->s_wtime > ctx->now) {
+ pctx.num = fs->super->s_wtime;
+ if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_WRITE, &pctx)) {
+ fs->super->s_wtime = ctx->now;
+ ext2fs_mark_super_dirty(fs);
+ }
+ }
+
/*
* Move the ext3 journal file, if necessary.
*/
e2fsck_move_ext3_journal(ctx);
+
+ /*
+ * Fix journal hint, if necessary
+ */
+ e2fsck_fix_ext3_journal_hint(ctx);
+
return;
}