printf(_("\n\n\007\007\007\007WARNING!!! "
"The filesystem is mounted. If you continue you ***WILL***\n"
"cause ***SEVERE*** filesystem damage.\007\007\007\n\n"));
- cont = ask_yn(_("Do you really want to continue"), -1);
+ cont = ask_yn(_("Do you really want to continue"), 0);
if (!cont) {
printf (_("check aborted.\n"));
exit (0);
static void check_if_skip(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
+ struct problem_context pctx;
const char *reason = NULL;
unsigned int reason_arg = 0;
long next_check;
fputs(_(", check forced.\n"), stdout);
return;
}
+
+ /*
+ * Update the global counts from the block group counts. This
+ * is needed since modern kernels don't update the global
+ * counts so as to avoid locking the entire file system. So
+ * if the filesystem is not unmounted cleanly, the global
+ * counts may not be accurate. Update them here if we can,
+ * for the benefit of users who might examine the file system
+ * using dumpe2fs. (This is for cosmetic reasons only.)
+ */
+ clear_problem_context(&pctx);
+ pctx.ino = fs->super->s_free_inodes_count;
+ pctx.ino2 = ctx->free_inodes;
+ if ((pctx.ino != pctx.ino2) &&
+ !(ctx->options & E2F_OPT_READONLY) &&
+ fix_problem(ctx, PR_0_FREE_INODE_COUNT, &pctx)) {
+ fs->super->s_free_inodes_count = ctx->free_inodes;
+ ext2fs_mark_super_dirty(fs);
+ }
+ clear_problem_context(&pctx);
+ pctx.blk = ext2fs_free_blocks_count(fs->super);
+ pctx.blk2 = ctx->free_blocks;
+ if ((pctx.blk != pctx.blk2) &&
+ !(ctx->options & E2F_OPT_READONLY) &&
+ fix_problem(ctx, PR_0_FREE_BLOCK_COUNT, &pctx)) {
+ ext2fs_free_blocks_count_set(fs->super, ctx->free_blocks);
+ ext2fs_mark_super_dirty(fs);
+ }
+
+ /* Print the summary message when we're skipping a full check */
printf(_("%s: clean, %u/%u files, %llu/%llu blocks"), ctx->device_name,
fs->super->s_inodes_count - fs->super->s_free_inodes_count,
fs->super->s_inodes_count,
char *cp;
clear_problem_context(&pctx);
+ sigcatcher_setup();
#ifdef MTRACE
mtrace();
#endif
* find the default journal size.
*/
if (sb->s_jnl_backup_type == EXT3_JNL_BACKUP_BLOCKS)
- journal_size = sb->s_jnl_blocks[16] >> 20;
+ journal_size = (sb->s_jnl_blocks[15] << (32 - 20)) |
+ (sb->s_jnl_blocks[16] >> 20);
else
journal_size = -1;
+ if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_QUOTA) {
+ int qtype;
+ /* Quotas were enabled. Do quota accounting during fsck. */
+ if ((sb->s_usr_quota_inum && sb->s_grp_quota_inum) ||
+ (!sb->s_usr_quota_inum && !sb->s_grp_quota_inum))
+ qtype = -1;
+ else
+ qtype = sb->s_usr_quota_inum ? USRQUOTA : GRPQUOTA;
+
+ init_quota_context(&ctx->qctx, ctx->fs, qtype);
+ }
+
run_result = e2fsck_run(ctx);
e2fsck_clear_progbar(ctx);
}
no_journal:
+ if (ctx->qctx) {
+ write_quota_inode(ctx->qctx, -1);
+ release_quota_context(&ctx->qctx);
+ }
+
if (run_result == E2F_FLAG_RESTART) {
printf(_("Restarting e2fsck from the beginning...\n"));
retval = e2fsck_reset_context(ctx);