diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-09-03 10:39:23 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-09-03 10:39:23 -0400 |
commit | dc5433647cb79bf1e7660f441c64330b3b8757cc (patch) | |
tree | b30581b2dbcd7f6f6822c69ef8bdc08625c78202 /e2fsck | |
parent | da801dfe03413e37dbbd02d69de986a8b13cd4ad (diff) | |
parent | 16eca7ce12e8c4613cc3a9940c62b687e27da514 (diff) | |
download | e2fsprogs-dc5433647cb79bf1e7660f441c64330b3b8757cc.tar.gz |
Merge branch 'maint' into next
Diffstat (limited to 'e2fsck')
-rw-r--r-- | e2fsck/pass1.c | 18 | ||||
-rw-r--r-- | e2fsck/pass3.c | 12 | ||||
-rw-r--r-- | e2fsck/problem.c | 19 | ||||
-rw-r--r-- | e2fsck/problem.h | 7 |
4 files changed, 46 insertions, 10 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 41eac0888..7018f1541 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1171,7 +1171,7 @@ void e2fsck_pass1(e2fsck_t ctx) struct scan_callback_struct scan_struct; struct ext2_super_block *sb = ctx->fs->super; const char *old_op; - int imagic_fs, extent_fs, inlinedata_fs; + int imagic_fs, extent_fs, inlinedata_fs, casefold_fs; int low_dtime_check = 1; unsigned int inode_size = EXT2_INODE_SIZE(fs->super); unsigned int bufsize; @@ -1217,6 +1217,7 @@ void e2fsck_pass1(e2fsck_t ctx) imagic_fs = ext2fs_has_feature_imagic_inodes(sb); extent_fs = ext2fs_has_feature_extents(sb); inlinedata_fs = ext2fs_has_feature_inline_data(sb); + casefold_fs = ext2fs_has_feature_casefold(sb); /* * Allocate bitmaps structures @@ -1340,8 +1341,10 @@ void e2fsck_pass1(e2fsck_t ctx) if (ctx->progress && ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count))) goto endit; - if ((fs->super->s_wtime < fs->super->s_inodes_count) || - (fs->super->s_mtime < fs->super->s_inodes_count) || + if ((fs->super->s_wtime && + fs->super->s_wtime < fs->super->s_inodes_count) || + (fs->super->s_mtime && + fs->super->s_mtime < fs->super->s_inodes_count) || (fs->super->s_mkfs_time && fs->super->s_mkfs_time < fs->super->s_inodes_count)) low_dtime_check = 0; @@ -1480,6 +1483,15 @@ void e2fsck_pass1(e2fsck_t ctx) continue; } + if ((inode->i_flags & EXT4_CASEFOLD_FL) && + ((!LINUX_S_ISDIR(inode->i_mode) && + fix_problem(ctx, PR_1_CASEFOLD_NONDIR, &pctx)) || + (!casefold_fs && + fix_problem(ctx, PR_1_CASEFOLD_FEATURE, &pctx)))) { + inode->i_flags &= ~EXT4_CASEFOLD_FL; + e2fsck_write_inode(ctx, ino, inode, "pass1"); + } + /* Conflicting inlinedata/extents inode flags? */ if ((inode->i_flags & EXT4_INLINE_DATA_FL) && (inode->i_flags & EXT4_EXTENTS_FL)) { diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c index 6a975b362..cedaaf5a5 100644 --- a/e2fsck/pass3.c +++ b/e2fsck/pass3.c @@ -157,7 +157,8 @@ static void check_root(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; blk64_t blk; - struct ext2_inode inode; + struct ext2_inode_large inode; + struct ext2_inode *iptr = (struct ext2_inode *) &inode; char * block; struct problem_context pctx; @@ -213,13 +214,15 @@ skip_new_block: inode.i_size = fs->blocksize; inode.i_atime = inode.i_ctime = inode.i_mtime = ctx->now; inode.i_links_count = 2; - ext2fs_iblk_set(fs, &inode, 1); + ext2fs_iblk_set(fs, iptr, 1); inode.i_block[0] = blk; + inode.i_extra_isize = sizeof(struct ext2_inode_large) - + EXT2_GOOD_OLD_INODE_SIZE; /* * Write out the inode. */ - pctx.errcode = ext2fs_write_new_inode(fs, EXT2_ROOT_INO, &inode); + pctx.errcode = ext2fs_write_new_inode(fs, EXT2_ROOT_INO, iptr); if (pctx.errcode) { pctx.str = "ext2fs_write_inode"; fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx); @@ -262,6 +265,9 @@ skip_new_block: ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, EXT2_ROOT_INO); ext2fs_mark_inode_bitmap2(fs->inode_map, EXT2_ROOT_INO); ext2fs_mark_ib_dirty(fs); + quota_data_add(ctx->qctx, &inode, EXT2_ROOT_INO, + EXT2_CLUSTER_SIZE(fs->super)); + quota_data_inodes(ctx->qctx, &inode, EXT2_ROOT_INO, +1); } /* diff --git a/e2fsck/problem.c b/e2fsck/problem.c index 4863ea7ab..27c695754 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -42,7 +42,8 @@ #define PROMPT_CLEAR_HTREE 18 #define PROMPT_RECREATE 19 #define PROMPT_OPTIMIZE 20 -#define PROMPT_NULL 21 +#define PROMPT_CLEAR_FLAG 21 +#define PROMPT_NULL 22 /* * These are the prompts which are used to ask the user if they want @@ -70,7 +71,8 @@ static const char *prompt[] = { N_("Clear HTree index"),/* 18 */ N_("Recreate"), /* 19 */ N_("Optimize"), /* 20 */ - "", /* 21 */ + N_("Clear flag"), /* 21 */ + "", /* 22 */ }; /* @@ -99,7 +101,8 @@ static const char *preen_msg[] = { N_("HTREE INDEX CLEARED"),/* 18 */ N_("WILL RECREATE"), /* 19 */ N_("WILL OPTIMIZE"), /* 20 */ - "", /* 21 */ + N_("FLAG CLEARED"), /* 21 */ + "", /* 22 */ }; #if __GNUC_PREREQ (4, 6) @@ -1246,6 +1249,16 @@ static struct e2fsck_problem problem_table[] = { N_("@i %i has @x marked uninitialized at @b %c (len %N). "), PROMPT_CLEAR, PR_PREEN_OK, 0, 0, 0 }, + /* Casefold flag set on a non-directory */ + { PR_1_CASEFOLD_NONDIR, + N_("@i %i has the casefold flag set but is not a directory. "), + PROMPT_CLEAR_FLAG, 0, 0, 0, 0 }, + + /* Casefold flag set, but file system is missing the casefold feature */ + { PR_1_CASEFOLD_FEATURE, + N_("@d %p has the casefold flag, but the\ncasefold feature is not enabled. "), + PROMPT_CLEAR_FLAG, 0, 0, 0, 0 }, + /* Pass 1b errors */ /* Pass 1B: Rescan for duplicate/bad blocks */ diff --git a/e2fsck/problem.h b/e2fsck/problem.h index 67a9f9527..5cc892499 100644 --- a/e2fsck/problem.h +++ b/e2fsck/problem.h @@ -565,7 +565,6 @@ struct problem_context { #define PR_1_EXTENTS_SET 0x01005A /* inode is in extents format, but superblock is missing EXTENTS feature */ -/* inode has extents, superblock missing INCOMPAT_EXTENTS feature */ #define PR_1_EXTENT_FEATURE 0x01005B /* inode missing EXTENTS_FL, but is an extent inode */ @@ -696,6 +695,12 @@ struct problem_context { /* Offer to clear uninitialized flag on an extent */ #define PR_1_CLEAR_UNINIT_EXTENT 0x010087 +/* Casefold flag set on a non-directory */ +#define PR_1_CASEFOLD_NONDIR 0x010088 + +/* Casefold flag set, but file system is missing the casefold feature */ +#define PR_1_CASEFOLD_FEATURE 0x010089 + /* * Pass 1b errors |