Merge branch 'maint' into next

Conflicts:
	e2fsck/unix.c
crypto
Theodore Ts'o 2014-08-10 19:33:31 -04:00
commit 68083287ae
13 changed files with 165 additions and 51 deletions

View File

@ -454,6 +454,11 @@ static struct e2fsck_problem problem_table[] = {
N_("@S 64bit filesystems needs extents to access the whole disk. "),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
/* The first_meta_bg is too big */
{ PR_0_FIRST_META_BG_TOO_BIG,
N_("First_meta_bg is too big. (%N, max value %g). "),
PROMPT_CLEAR, 0 },
/* Pass 1 errors */
/* Pass 1: Checking inodes, blocks, and sizes */
@ -1886,6 +1891,21 @@ static struct e2fsck_problem problem_table[] = {
N_("Update quota info for quota type %N"),
PROMPT_NULL, PR_PREEN_OK },
/* Error setting block group checksum info */
{ PR_6_SET_BG_CHECKSUM,
N_("Error setting @b @g checksum info: %m\n"),
PROMPT_NULL, PR_FATAL },
/* Error writing file system info */
{ PR_6_FLUSH_FILESYSTEM,
N_("Error writing file system info: %m\n"),
PROMPT_NULL, PR_FATAL },
/* Error flushing writes to storage device */
{ PR_6_IO_FLUSH,
N_("Error flushing writes to strage device: %m\n"),
PROMPT_NULL, PR_FATAL },
{ 0 }
};

View File

@ -249,9 +249,6 @@ struct problem_context {
/* Checking group descriptor failed */
#define PR_0_CHECK_DESC_FAILED 0x000045
/* 64bit is set but extents are not set. */
#define PR_0_64BIT_WITHOUT_EXTENTS 0x000048
/*
* metadata_csum supersedes uninit_bg; both feature bits cannot be set
* simultaneously.
@ -261,6 +258,11 @@ struct problem_context {
/* Superblock has invalid MMP checksum. */
#define PR_0_MMP_CSUM_INVALID 0x000047
/* 64bit is set but extents are not set. */
#define PR_0_64BIT_WITHOUT_EXTENTS 0x000048
/* The first_meta_bg is too big */
#define PR_0_FIRST_META_BG_TOO_BIG 0x000049
/*
* Pass 1 errors
@ -1135,6 +1137,15 @@ struct problem_context {
/* Update quota information if it is inconsistent */
#define PR_6_UPDATE_QUOTAS 0x060002
/* Error setting block group checksum info */
#define PR_6_SET_BG_CHECKSUM 0x060003
/* Error writing file system info */
#define PR_6_FLUSH_FILESYSTEM 0x060004
/* Error flushing writes to storage device */
#define PR_6_IO_FLUSH 0x060005
/*
* Function declarations
*/

View File

@ -606,6 +606,18 @@ void check_super_block(e2fsck_t ctx)
ext2fs_mark_super_dirty(fs);
}
if ((fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) &&
(fs->super->s_first_meta_bg > fs->desc_blocks)) {
pctx.group = fs->desc_blocks;
pctx.num = fs->super->s_first_meta_bg;
if (fix_problem(ctx, PR_0_FIRST_META_BG_TOO_BIG, &pctx)) {
fs->super->s_feature_incompat &=
~EXT2_FEATURE_INCOMPAT_META_BG;
fs->super->s_first_meta_bg = 0;
ext2fs_mark_super_dirty(fs);
}
}
/*
* Verify the group descriptors....
*/

View File

@ -1184,7 +1184,7 @@ int main (int argc, char *argv[])
e2fsck_t ctx;
blk64_t orig_superblock;
struct problem_context pctx;
int flags, run_result;
int flags, run_result, was_changed;
int journal_size;
int sysval, sys_page_size = 4096;
int old_bitmaps;
@ -1703,22 +1703,45 @@ no_journal:
ext2fs_close_free(&fs);
goto restart;
}
if (run_result & E2F_FLAG_CANCEL) {
log_out(ctx, _("%s: e2fsck canceled.\n"), ctx->device_name ?
ctx->device_name : ctx->filesystem_name);
exit_value |= FSCK_CANCELED;
}
if (run_result & E2F_FLAG_ABORT)
fatal_error(ctx, _("aborted"));
if (check_backup_super_block(ctx)) {
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
ext2fs_mark_super_dirty(fs);
}
#ifdef MTRACE
mtrace_print("Cleanup");
#endif
if (ext2fs_test_changed(fs)) {
was_changed = ext2fs_test_changed(fs);
if (run_result & E2F_FLAG_CANCEL) {
log_out(ctx, _("%s: e2fsck canceled.\n"), ctx->device_name ?
ctx->device_name : ctx->filesystem_name);
exit_value |= FSCK_CANCELED;
} else if (!(ctx->options & E2F_OPT_READONLY)) {
if (ext2fs_test_valid(fs)) {
if (!(sb->s_state & EXT2_VALID_FS))
exit_value |= FSCK_NONDESTRUCT;
sb->s_state = EXT2_VALID_FS;
if (check_backup_super_block(ctx))
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
} else
sb->s_state &= ~EXT2_VALID_FS;
if (!(ctx->flags & E2F_FLAG_TIME_INSANE))
sb->s_lastcheck = ctx->now;
sb->s_mnt_count = 0;
memset(((char *) sb) + EXT4_S_ERR_START, 0, EXT4_S_ERR_LEN);
pctx.errcode = ext2fs_set_gdt_csum(ctx->fs);
if (pctx.errcode)
fix_problem(ctx, PR_6_SET_BG_CHECKSUM, &pctx);
ext2fs_mark_super_dirty(fs);
}
e2fsck_write_bitmaps(ctx);
pctx.errcode = ext2fs_flush(ctx->fs);
if (pctx.errcode)
fix_problem(ctx, PR_6_FLUSH_FILESYSTEM, &pctx);
pctx.errcode = io_channel_flush(ctx->fs->io);
if (pctx.errcode)
fix_problem(ctx, PR_6_IO_FLUSH, &pctx);
if (was_changed) {
exit_value |= FSCK_NONDESTRUCT;
if (!(ctx->options & E2F_OPT_PREEN))
log_out(ctx, _("\n%s: ***** FILE SYSTEM WAS "
@ -1749,37 +1772,9 @@ no_journal:
(sb->s_state & EXT2_VALID_FS) &&
!(sb->s_state & EXT2_ERROR_FS))
exit_value = 0;
} else {
} else
show_stats(ctx);
if (!(ctx->options & E2F_OPT_READONLY)) {
if (ext2fs_test_valid(fs)) {
if (!(sb->s_state & EXT2_VALID_FS))
exit_value |= FSCK_NONDESTRUCT;
sb->s_state = EXT2_VALID_FS;
} else
sb->s_state &= ~EXT2_VALID_FS;
sb->s_mnt_count = 0;
if (!(ctx->flags & E2F_FLAG_TIME_INSANE))
sb->s_lastcheck = ctx->now;
memset(((char *) sb) + EXT4_S_ERR_START, 0,
EXT4_S_ERR_LEN);
ext2fs_mark_super_dirty(fs);
}
}
if ((run_result & E2F_FLAG_CANCEL) == 0 &&
ext2fs_has_group_desc_csum(ctx->fs) &&
!(ctx->options & E2F_OPT_READONLY)) {
retval = ext2fs_set_gdt_csum(ctx->fs);
if (retval) {
com_err(ctx->program_name, retval, "%s",
_("while setting block group checksum info"));
fatal_error(ctx, 0);
}
}
e2fsck_write_bitmaps(ctx);
io_channel_flush(ctx->fs->io);
print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
ext2fs_close_free(&ctx->fs);

View File

@ -362,9 +362,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
* superblocks and group descriptors.
*/
group_ptr = (char *) group_shadow;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
old_desc_blocks = fs->super->s_first_meta_bg;
else
if (old_desc_blocks > fs->super->s_first_meta_bg)
old_desc_blocks = fs->desc_blocks;
} else
old_desc_blocks = fs->desc_blocks;
if (fs->progress_ops && fs->progress_ops->init)

View File

@ -405,9 +405,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
#ifdef WORDS_BIGENDIAN
groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
#endif
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
first_meta_bg = fs->super->s_first_meta_bg;
else
if (first_meta_bg > fs->desc_blocks)
first_meta_bg = fs->desc_blocks;
} else
first_meta_bg = fs->desc_blocks;
if (first_meta_bg) {
retval = io_channel_read_blk(fs->io, group_block +

View File

@ -488,6 +488,13 @@ retry:
fs->super->s_reserved_gdt_blocks = new;
}
if ((fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) &&
(fs->super->s_first_meta_bg > fs->desc_blocks)) {
fs->super->s_feature_incompat &=
~EXT2_FEATURE_INCOMPAT_META_BG;
fs->super->s_first_meta_bg = 0;
}
/*
* Update the location of the backup superblocks if the
* sparse_super2 feature is enabled.
@ -993,13 +1000,15 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
ext2fs_mark_block_bitmap2(rfs->reserve_blocks, blk);
}
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
if (old_fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_blocks = old_fs->super->s_first_meta_bg;
else
old_blocks = old_fs->desc_blocks +
old_fs->super->s_reserved_gdt_blocks;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
new_blocks = fs->super->s_first_meta_bg;
} else {
old_blocks = old_fs->desc_blocks + old_fs->super->s_reserved_gdt_blocks;
else
new_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
}
retval = reserve_sparse_super2_last_group(rfs, meta_bmap);
if (retval)

View File

@ -0,0 +1,20 @@
First_meta_bg is too big. (2, max value 1). Clear? yes
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -3
Fix? yes
Free blocks count wrong for group #0 (79, counted=80).
Fix? yes
Free blocks count wrong (79, counted=80).
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/16 files (0.0% non-contiguous), 20/100 blocks
Exit status is 1

View File

@ -0,0 +1,7 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 11/16 files (0.0% non-contiguous), 20/100 blocks
Exit status is 0

Binary file not shown.

View File

@ -0,0 +1 @@
s_first_meta_bg is too large

View File

@ -0,0 +1,34 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
test_description="meta_bg shrink"
FEATURES="-t ext4 -O 64bit,meta_bg,^resize_inode -b 1024"
SIZE_1=1G
SIZE_2=48M
LOG=$test_name.log
E2FSCK=../e2fsck/e2fsck
RESIZE2FS_OPTS=-f
. $cmd_dir/scripts/resize_test
export MKE2FS_FIRST_META_BG=2
resize_test
unset MKE2FS_FIRST_META_BG
RC=$?
if [ $RC -eq 0 ]; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
elif [ $RC -eq 111 ]; then
echo "$test_name: $test_description: skipped"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
ln $LOG $test_name.failed
fi
unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -32,6 +32,7 @@ E2FSCK_CONFIG=/dev/null
export E2FSCK_CONFIG
MKE2FS_CONFIG=./mke2fs.conf
export MKE2FS_CONFIG
unset MKE2FS_FIRST_META_BG
E2FSPROGS_SKIP_PROGRESS=yes
export E2FSPROGS_SKIP_PROGRESS
EXT2FS_NO_MTAB_OK=yes