From f2cbf119ecc5940565ba074a8c3072b6fb2b81a2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 30 2018 05:03:39 +0000 Subject: import e2fsprogs-1.42.9-13.el7 --- diff --git a/SOURCES/e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch b/SOURCES/e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch new file mode 100644 index 0000000..710923a --- /dev/null +++ b/SOURCES/e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch @@ -0,0 +1,64 @@ +From 35da59eaf201d5935d7047657355f129f3791d9a Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Sat, 11 Jan 2014 13:54:57 -0500 +Subject: [PATCH 1/2] libext2fs: detect correct superblock adjustments when + loading backup groups + +If ext2fs_descriptor_block_loc2() is called with a meta_bg filesystem +and group_block is not the normal value, the function will return the +location of the backup group descriptor block in the next block group. +Unfortunately, it fails to account for the possibility that the backup +group contains a backup superblock but the regular superblock does +not. This is the case with block groups 48-49 on a meta_bg fs with 1k +blocks; in this case, libext2fs will fail to open the filesystem. + +Therefore, teach the function to adjust for superblocks in the backup +group, if necessary. + +Signed-off-by: Darrick J. Wong +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/openfs.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c +index 2c6e10e..b27bf19 100644 +--- a/lib/ext2fs/openfs.c ++++ b/lib/ext2fs/openfs.c +@@ -47,7 +47,7 @@ blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block, + bg = EXT2_DESC_PER_BLOCK(fs->super) * i; + if (ext2fs_bg_has_super(fs, bg)) + has_super = 1; +- ret_blk = ext2fs_group_first_block2(fs, bg) + has_super; ++ ret_blk = ext2fs_group_first_block2(fs, bg); + /* + * If group_block is not the normal value, we're trying to use + * the backup group descriptors and superblock --- so use the +@@ -57,10 +57,21 @@ blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block, + * have the infrastructure in place to do that. + */ + if (group_block != fs->super->s_first_data_block && +- ((ret_blk + fs->super->s_blocks_per_group) < +- ext2fs_blocks_count(fs->super))) ++ ((ret_blk + has_super + fs->super->s_blocks_per_group) < ++ ext2fs_blocks_count(fs->super))) { + ret_blk += fs->super->s_blocks_per_group; +- return ret_blk; ++ ++ /* ++ * If we're going to jump forward a block group, make sure ++ * that we adjust has_super to account for the next group's ++ * backup superblock (or lack thereof). ++ */ ++ if (ext2fs_bg_has_super(fs, bg + 1)) ++ has_super = 1; ++ else ++ has_super = 0; ++ } ++ return ret_blk + has_super; + } + + blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) +-- +2.17.1 + diff --git a/SOURCES/e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch b/SOURCES/e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch new file mode 100644 index 0000000..5e007b4 --- /dev/null +++ b/SOURCES/e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch @@ -0,0 +1,120 @@ +From 9a7df1b3a2d139ed930ff9ed606b804e71df1cce Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Sat, 11 Jan 2014 13:58:15 -0500 +Subject: [PATCH 2/2] libext2fs: don't always read backup group descriptors on + a 1k-block meta_bg fs + +On a filesystem with 1K blocks and meta_bg enabled, opening a +filesystem with automatic superblock detection tries to compensate for +the fact that the superblock lives in block 1. However, the method by +which this is done is later misinterpreted to mean "read the backup +group descriptors", which is not what we want in this case. + +Therefore, in ext2fs_open3() separate the 'group zero' adjustment into +its own variable so that we don't get fed backup group descriptors +when we try to load meta_bg group descriptors. + +Furthermore, enhance ext2fs_descriptor_block_loc2() to perform its own +group zero correction. The other caller of this function neglects to +do any group-zero correction of their own, so this fixes them too. + +Signed-off-by: Darrick J. Wong +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/ext2fs.h | 5 +++++ + lib/ext2fs/openfs.c | 30 +++++++++++++++++++++++++----- + 2 files changed, 30 insertions(+), 5 deletions(-) + +diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h +index cb03ecf..380608b 100644 +--- a/lib/ext2fs/ext2fs.h ++++ b/lib/ext2fs/ext2fs.h +@@ -1376,6 +1376,11 @@ extern errcode_t ext2fs_open2(const char *name, const char *io_options, + int flags, int superblock, + unsigned int block_size, io_manager manager, + ext2_filsys *ret_fs); ++/* ++ * The dgrp_t argument to these two functions is not actually a group number ++ * but a block number offset within a group table! Convert with the formula ++ * (group_number / groups_per_block). ++ */ + extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, + blk64_t group_block, dgrp_t i); + extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, +diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c +index b27bf19..ba501e6 100644 +--- a/lib/ext2fs/openfs.c ++++ b/lib/ext2fs/openfs.c +@@ -37,12 +37,19 @@ blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block, + dgrp_t i) + { + int bg; +- int has_super = 0; ++ int has_super = 0, group_zero_adjust = 0; + blk64_t ret_blk; + ++ /* ++ * On a bigalloc FS with 1K blocks, block 0 is reserved for non-ext4 ++ * stuff, so adjust for that if we're being asked for group 0. ++ */ ++ if (i == 0 && fs->blocksize == 1024 && EXT2FS_CLUSTER_RATIO(fs) > 1) ++ group_zero_adjust = 1; ++ + if (!(fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) || + (i < fs->super->s_first_meta_bg)) +- return (group_block + i + 1); ++ return group_block + i + 1 + group_zero_adjust; + + bg = EXT2_DESC_PER_BLOCK(fs->super) * i; + if (ext2fs_bg_has_super(fs, bg)) +@@ -71,7 +78,7 @@ blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block, + else + has_super = 0; + } +- return ret_blk + has_super; ++ return ret_blk + has_super + group_zero_adjust; + } + + blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) +@@ -113,6 +120,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, + unsigned int blocks_per_group, io_flags; + blk64_t group_block, blk; + char *dest, *cp; ++ int group_zero_adjust = 0; + #ifdef WORDS_BIGENDIAN + unsigned int groups_per_block; + struct ext2_group_desc *gdp; +@@ -353,8 +361,19 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, + goto cleanup; + if (!group_block) + group_block = fs->super->s_first_data_block; ++ /* ++ * On a FS with a 1K blocksize, block 0 is reserved for bootloaders ++ * so we must increment block numbers to any group 0 items. ++ * ++ * However, we cannot touch group_block directly because in the meta_bg ++ * case, the ext2fs_descriptor_block_loc2() function will interpret ++ * group_block != s_first_data_block to mean that we want to access the ++ * backup group descriptors. This is not what we want if the caller ++ * set superblock == 0 (i.e. auto-detect the superblock), which is ++ * what's going on here. ++ */ + if (group_block == 0 && fs->blocksize == 1024) +- group_block = 1; /* Deal with 1024 blocksize && bigalloc */ ++ group_zero_adjust = 1; + dest = (char *) fs->group_desc; + #ifdef WORDS_BIGENDIAN + groups_per_block = EXT2_DESC_PER_BLOCK(fs->super); +@@ -366,7 +385,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, + } else + first_meta_bg = fs->desc_blocks; + if (first_meta_bg) { +- retval = io_channel_read_blk(fs->io, group_block+1, ++ retval = io_channel_read_blk(fs->io, group_block + ++ group_zero_adjust + 1, + first_meta_bg, dest); + if (retval) + goto cleanup; +-- +2.17.1 + diff --git a/SOURCES/e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch b/SOURCES/e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch new file mode 100644 index 0000000..3f25251 --- /dev/null +++ b/SOURCES/e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch @@ -0,0 +1,40 @@ +From 90f0190ac3d2f77a420aaf6ad78b0fb9b93f4698 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Mon, 9 Apr 2018 15:28:12 -0400 +Subject: [PATCH] e2fsck: warn if checkinterval and broken_system_clock both + set + +If broken_system_clock is set in e2fsck.conf and this causes +the check interval to be ignored, make that clear to the user: + +e2fsck 1.44.1 (24-Mar-2018) +/dev/sda1: ignoring check interval, broken_system_clock set +/dev/sda1: clean, 11/65536 files, 12955/262144 blocks + +Signed-off-by: Eric Sandeen +Signed-off-by: Theodore Ts'o +Reviewed-by: Lukas Czerner +--- + e2fsck/unix.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/e2fsck/unix.c b/e2fsck/unix.c +index 6f94644..d94d5dc 100644 +--- a/e2fsck/unix.c ++++ b/e2fsck/unix.c +@@ -384,7 +384,12 @@ static void check_if_skip(e2fsck_t ctx) + if (batt && ((ctx->now - fs->super->s_lastcheck) < + fs->super->s_checkinterval*2)) + reason = 0; ++ } else if (broken_system_clock && fs->super->s_checkinterval) { ++ log_out(ctx, "%s: ", ctx->device_name); ++ log_out(ctx, "%s", ++ _("ignoring check interval, broken_system_clock set\n")); + } ++ + if (reason) { + log_out(ctx, "%s", ctx->device_name); + log_out(ctx, reason, reason_arg); +-- +2.17.1 + diff --git a/SPECS/e2fsprogs.spec b/SPECS/e2fsprogs.spec index 1d01e7c..6c823d3 100644 --- a/SPECS/e2fsprogs.spec +++ b/SPECS/e2fsprogs.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing ext2, ext3, and ext4 filesystems Name: e2fsprogs Version: 1.42.9 -Release: 12%{?dist} +Release: 13%{?dist} # License tags based on COPYING file distinctions for various components License: GPLv2 @@ -37,6 +37,9 @@ Patch24: e2fsprogs-1.42.10-Fix-nroff-macro-issue-in-chattr-man-page.patch Patch25: e2fsprogs-1.43.6-libext2fs-skip-start_blk-adjustment-when-stride-and-.patch Patch26: e2fsprogs-1.43.4-tune2fs-edit-dire-warning-about-check-intervals.patch Patch27: e2fsprogs-1.42.11-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch +Patch28: e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch +Patch29: e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch +Patch30: e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch Url: http://e2fsprogs.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -213,6 +216,9 @@ It was originally inspired by the Multics SubSystem library. %patch25 -p1 %patch26 -p1 %patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 %build %configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \ @@ -405,6 +411,10 @@ exit 0 %{_libdir}/pkgconfig/ss.pc %changelog +* Tue Jun 13 2018 Lukas Czerner 1.42.9-13 +- e2fsck: warn if checkinterval and broken_system_clock both set (#1365594) +- e2fsprogs: fail to open 1k block size ext4 with bigalloc,meta_bg,^resize_inode (#1448019) + * Tue Mar 23 2018 Lukas Czerner 1.42.9-12 - Fix 32/64-bit overflow when multiplying by blocks/clusters per group (#1553004)