Browse Source

e2fsprogs package version update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 3 years ago
parent
commit
4116216f3e
  1. 22
      SOURCES/e2fsprogs-1.40.4-sb_feature_check_ignore.patch
  2. 3
      SOURCES/e2fsprogs-1.42.10-Fix-nroff-macro-issue-in-chattr-man-page.patch
  3. 173
      SOURCES/e2fsprogs-1.42.11-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
  4. 33
      SOURCES/e2fsprogs-1.42.11-e2fsck-free-ctx-fs-not-fs-at-the-end-of-fsck.patch
  5. 34
      SOURCES/e2fsprogs-1.42.9-14-Clarify-how-the-description-of-the-dir_nlink-feature.patch
  6. 32
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-fd-leak-in-reserve_stdio_fds.patch
  7. 51
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-free-pointer-dereferences.patch
  8. 45
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-last-mount-time-and-last-write-time-in-pr.patch
  9. 39
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-off-by-one-bounds-check-on-group-number.patch
  10. 66
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-potential-Floating-Point-Exception-in-sho.patch
  11. 64
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-if-any-problems-are-fixed-in-pass-0-check-the.patch
  12. 81
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-remove-resize-inode-if-both-resize_inode-and-.patch
  13. 101
      SOURCES/e2fsprogs-1.42.9-14-e2fsck-set-dir_nlink-feature-if-large-dir-exists.patch
  14. 439
      SOURCES/e2fsprogs-1.42.9-14-e2fsprogs-introduce-ext2fs_close_free-helper.patch
  15. 31
      SOURCES/e2fsprogs-1.42.9-14-filefrag-don-t-ignore-fsync-errors.patch
  16. 37
      SOURCES/e2fsprogs-1.42.9-14-libext2fs-automatically-enable-meta_bg-to-avoid-fill.patch
  17. 52
      SOURCES/e2fsprogs-1.42.9-14-libext2fs-don-t-create-filesystems-with-meta_bg-and-.patch
  18. 44
      SOURCES/e2fsprogs-1.42.9-14-libext2fs-fix-ext2fs_open2-error-for-meta_bg-image-f.patch
  19. 42
      SOURCES/e2fsprogs-1.42.9-14-libext2fs-fix-maximum-bg-overhead-calculation-with-m.patch
  20. 100
      SOURCES/e2fsprogs-1.42.9-14-misc-fix-Coverity-bugs.patch
  21. 44
      SOURCES/e2fsprogs-1.42.9-14-mke2fs-Avoid-crashes-infinite-loops-for-absurdly-lar.patch
  22. 53
      SOURCES/e2fsprogs-1.42.9-14-resize2fs-Remove-the-real-kilobytes-rant-from-man-pa.patch
  23. 29
      SOURCES/e2fsprogs-1.42.9-Fix-typo-in-the-ext4-5-man-page.patch
  24. 43
      SOURCES/e2fsprogs-1.42.9-add-revision-to-the-is_before_linux_ver.patch
  25. 4
      SOURCES/e2fsprogs-1.42.9-chattr-manpage-j-update.patch
  26. 14
      SOURCES/e2fsprogs-1.42.9-chattr-manpage-reorder.patch
  27. 16
      SOURCES/e2fsprogs-1.42.9-chattr-manpage-update.patch
  28. 18
      SOURCES/e2fsprogs-1.42.9-defrag-backwards-files.patch
  29. 15
      SOURCES/e2fsprogs-1.42.9-disable-resize_inode-feature-if-64bit-feature-is-enabled.patch
  30. 18
      SOURCES/e2fsprogs-1.42.9-dont-require-fsck-for-resize-p.patch
  31. 54
      SOURCES/e2fsprogs-1.42.9-e2fsck-abort-if-there-is-a-corrupted-directory-block.patch
  32. 97
      SOURCES/e2fsprogs-1.42.9-e2fsck-clarify-overflow-link-count-error-message.patch
  33. 48
      SOURCES/e2fsprogs-1.42.9-e2fsck-don-t-try-to-rehash-a-deleted-directory.patch
  34. 228
      SOURCES/e2fsprogs-1.42.9-e2image-fix-metadata-image-handling-on-big-endian-sy.patch
  35. 15
      SOURCES/e2fsprogs-1.42.9-enable-64bit-feature-by-default.patch
  36. 15
      SOURCES/e2fsprogs-1.42.9-enable-lazy_itable_init-on-newer-kernel-by-default.patch
  37. 10
      SOURCES/e2fsprogs-1.42.9-ext4-manpage-add-attrs.patch
  38. 8
      SOURCES/e2fsprogs-1.42.9-ext4-manpage-add-mountopts.patch
  39. 6
      SOURCES/e2fsprogs-1.42.9-fix-endian-handling-of-ext3_extent_header.patch
  40. 42
      SOURCES/e2fsprogs-1.42.9-force-journal-remove.patch
  41. 30
      SOURCES/e2fsprogs-1.42.9-libext2fs-avoid-buffer-overflow.patch
  42. 38
      SOURCES/e2fsprogs-1.42.9-libext2fs-buffer-overflow-closefs.patch
  43. 25
      SOURCES/e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch
  44. 71
      SOURCES/e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch
  45. 212
      SOURCES/e2fsprogs-1.42.9-libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch
  46. 49
      SOURCES/e2fsprogs-1.42.9-mke2fs-clean-up-kernel-version-tests.patch
  47. 31
      SOURCES/e2fsprogs-1.42.9-mke2fs.conf-Introduce-rhel6-fs_type.patch
  48. 20
      SOURCES/e2fsprogs-1.42.9-mkfs-revision-too-high.patch
  49. 8
      SOURCES/e2fsprogs-1.42.9-no-ppc-altivec.patch
  50. 32
      SOURCES/e2fsprogs-1.42.9-resize2fs-clear-uninit-BG.patch
  51. 28
      SOURCES/e2fsprogs-1.42.9-resize2fs-fix-resizing-large-file-systems-when-block.patch
  52. 52
      SOURCES/e2fsprogs-1.42.9-resize2fs-fs-with-errors.patch
  53. 37
      SOURCES/e2fsprogs-1.42.9-set-pointer-to-NULL-after-ext2fs_free.patch
  54. 43
      SOURCES/e2fsprogs-1.43.3-libext2fs-don-t-ignore-fsync-errors.patch
  55. 5
      SOURCES/e2fsprogs-1.43.4-tune2fs-edit-dire-warning-about-check-intervals.patch
  56. 15
      SOURCES/e2fsprogs-1.43.6-libext2fs-skip-start_blk-adjustment-when-stride-and-.patch
  57. 17
      SOURCES/e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch
  58. 69
      SOURCES/e2fsprogs-1.45.6-e2fsck-fix-file-systems-with-an-overly-large-s_first.patch
  59. 60
      SOURCES/e2fsprogs-1.45.6-resize2fs-disable-the-meta_bg-feature-if-necessary.patch
  60. 69
      SOURCES/e2fsprogs-1.45.6-tests-add-f_first_meta_bg_too_big-test.patch
  61. 59
      SOURCES/e2fsprogs-1.45.6-tests-add-the-r_meta_bg_shrink-test.patch
  62. 29
      SOURCES/e2fsprogs-1.45.6-tests-make-sure-MKE2FS_FIRST_META_BG-is-unset-while-.patch
  63. 1
      SOURCES/ext2_types-wrapper.h
  64. BIN
      SOURCES/image.gz
  65. 109
      SPECS/e2fsprogs.spec

22
SOURCES/e2fsprogs-1.40.4-sb_feature_check_ignore.patch

@ -12,24 +12,24 @@ Index: e2fsprogs-1.41.5/e2fsck/super.c @@ -12,24 +12,24 @@ Index: e2fsprogs-1.41.5/e2fsck/super.c
*/
+#define FEATURE_COMPAT_IGNORE (EXT2_FEATURE_COMPAT_EXT_ATTR)
#define FEATURE_RO_COMPAT_IGNORE (EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
#define FEATURE_INCOMPAT_IGNORE (EXT3_FEATURE_INCOMPAT_EXTENTS| \
@@ -921,6 +925,9 @@ int check_backup_super_block(e2fsck_t ct
(EXT2_INODE_SIZE(backup_sb) < EXT2_GOOD_OLD_INODE_SIZE))
continue;

(EXT2_INODE_SIZE(backup_sb) < EXT2_GOOD_OLD_INODE_SIZE))
continue;
+#define SUPER_COMPAT_DIFFERENT(x) \
+ ((fs->super->x & ~FEATURE_COMPAT_IGNORE) != \
+ (backup_sb->x & ~FEATURE_COMPAT_IGNORE))
#define SUPER_INCOMPAT_DIFFERENT(x) \
((fs->super->x & ~FEATURE_INCOMPAT_IGNORE) != \
(backup_sb->x & ~FEATURE_INCOMPAT_IGNORE))
((fs->super->x & ~FEATURE_INCOMPAT_IGNORE) != \
(backup_sb->x & ~FEATURE_INCOMPAT_IGNORE))
@@ -930,7 +937,7 @@ int check_backup_super_block(e2fsck_t ct
#define SUPER_DIFFERENT(x) \
(fs->super->x != backup_sb->x)

(fs->super->x != backup_sb->x)
- if (SUPER_DIFFERENT(s_feature_compat) ||
+ if (SUPER_COMPAT_DIFFERENT(s_feature_compat) ||
SUPER_INCOMPAT_DIFFERENT(s_feature_incompat) ||
SUPER_RO_COMPAT_DIFFERENT(s_feature_ro_compat) ||
SUPER_DIFFERENT(s_blocks_count) ||
SUPER_INCOMPAT_DIFFERENT(s_feature_incompat) ||
SUPER_RO_COMPAT_DIFFERENT(s_feature_ro_compat) ||
SUPER_DIFFERENT(s_blocks_count) ||

3
SOURCES/e2fsprogs-1.42.10-Fix-nroff-macro-issue-in-chattr-man-page.patch

@ -26,5 +26,6 @@ index 23b6938..75b3ed8 100644 @@ -26,5 +26,6 @@ index 23b6938..75b3ed8 100644
.PP
The letters 'aAcCdDeijsStTu' select the new attributes for the files:
append only (a),
--
--
2.7.4


173
SOURCES/e2fsprogs-1.42.11-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch

@ -34,27 +34,27 @@ index 4409d7f..831232b 100644 @@ -34,27 +34,27 @@ index 4409d7f..831232b 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -858,7 +858,7 @@ static void check_block_end(e2fsck_t ctx)
clear_problem_context(&pctx);

end = ext2fs_get_block_bitmap_start2(fs->block_map) +
clear_problem_context(&pctx);
end = ext2fs_get_block_bitmap_start2(fs->block_map) +
- ((blk64_t)EXT2_CLUSTERS_PER_GROUP(fs->super) * fs->group_desc_count) - 1;
+ EXT2_GROUPS_TO_CLUSTERS(fs->super, fs->group_desc_count) - 1;
pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, end,
&save_blocks_count);
if (pctx.errcode) {
pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, end,
&save_blocks_count);
if (pctx.errcode) {
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 2fcb315..a6be3c6 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -421,7 +421,7 @@ void check_resize_inode(e2fsck_t ctx)
for (j = 1; j < fs->group_desc_count; j++) {
if (!ext2fs_bg_has_super(fs, j))
continue;
for (j = 1; j < fs->group_desc_count; j++) {
if (!ext2fs_bg_has_super(fs, j))
continue;
- expect = pblk + (j * fs->super->s_blocks_per_group);
+ expect = pblk + EXT2_GROUPS_TO_BLOCKS(fs->super, j);
if (ind_buf[ind_off] != expect)
goto resize_inode_invalid;
ind_off++;
if (ind_buf[ind_off] != expect)
goto resize_inode_invalid;
ind_off++;
diff --git a/lib/ext2fs/blknum.c b/lib/ext2fs/blknum.c
index 7a2c588..88cc34e 100644
--- a/lib/ext2fs/blknum.c
@ -62,11 +62,11 @@ index 7a2c588..88cc34e 100644 @@ -62,11 +62,11 @@ index 7a2c588..88cc34e 100644
@@ -29,7 +29,7 @@ dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t blk)
blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group)
{
return fs->super->s_first_data_block +
return fs->super->s_first_data_block +
- ((blk64_t)group * fs->super->s_blocks_per_group);
+ EXT2_GROUPS_TO_BLOCKS(fs->super, group);
}

/*
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 930c2a3..d6adfd4 100644
@ -75,7 +75,7 @@ index 930c2a3..d6adfd4 100644 @@ -75,7 +75,7 @@ index 930c2a3..d6adfd4 100644
@@ -264,6 +264,11 @@ struct ext2_dx_countlimit {
#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
#endif

+#define EXT2_GROUPS_TO_BLOCKS(s, g) ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \
+ (g))
+#define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \
@ -89,132 +89,133 @@ index 378a3c8..b643cc6 100644 @@ -89,132 +89,133 @@ index 378a3c8..b643cc6 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -286,8 +286,8 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
ext2fs_generic_bitmap bmap;
errcode_t retval;
ssize_t actual;
ext2fs_generic_bitmap bmap;
errcode_t retval;
ssize_t actual;
- __u32 itr, cnt, size;
- int c, total_size;
+ size_t c;
+ __u64 itr, cnt, size, total_size;
char buf[1024];

if (flags & IMAGER_FLAG_INODEMAP) {
char buf[1024];
if (flags & IMAGER_FLAG_INODEMAP) {
@@ -308,7 +308,7 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
- cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count);
size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}
total_size = size * fs->group_desc_count;
size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}
total_size = size * fs->group_desc_count;
@@ -342,9 +342,9 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
if (c > (int) sizeof(buf))
c = sizeof(buf);
actual = write(fd, buf, c);
if (c > (int) sizeof(buf))
c = sizeof(buf);
actual = write(fd, buf, c);
- if (actual == -1)
+ if (actual < 0)
return errno;
return errno;
- if (actual != c)
+ if ((size_t) actual != c)
return EXT2_ET_SHORT_WRITE;
size -= c;
}
return EXT2_ET_SHORT_WRITE;
size -= c;
}
@@ -360,7 +360,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
{
ext2fs_generic_bitmap bmap;
errcode_t retval;
ext2fs_generic_bitmap bmap;
errcode_t retval;
- __u32 itr, cnt;
+ __u64 itr, cnt;
char buf[1024];
unsigned int size;
ssize_t actual;
char buf[1024];
unsigned int size;
ssize_t actual;
@@ -383,7 +383,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
- cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count);
size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}

size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index b7d65a9..ad1d8c8 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -225,8 +225,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
}
blk = (fs->image_header->offset_blockmap /
fs->blocksize);
}
blk = (fs->image_header->offset_blockmap /
fs->blocksize);
- blk_cnt = (blk64_t)EXT2_CLUSTERS_PER_GROUP(fs->super) *
- fs->group_desc_count;
+ blk_cnt = EXT2_GROUPS_TO_CLUSTERS(fs->super,
+ fs->group_desc_count);
while (block_nbytes > 0) {
retval = io_channel_read_blk64(fs->image_io, blk++,
1, block_bitmap);
while (block_nbytes > 0) {
retval = io_channel_read_blk64(fs->image_io, blk++,
1, block_bitmap);
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index ff72e09..d2aa125 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1366,7 +1366,7 @@ static int ext2fs_is_block_in_group(ext2_filsys fs, dgrp_t group, blk64_t blk)
{
blk64_t start_blk, end_blk;
start_blk = fs->super->s_first_data_block +
blk64_t start_blk, end_blk;
start_blk = fs->super->s_first_data_block +
- EXT2_BLOCKS_PER_GROUP(fs->super) * group;
+ EXT2_GROUPS_TO_BLOCKS(fs->super, group);
/*
* We cannot get new block beyond end_blk for for the last block group
* so we can check with EXT2_BLOCKS_PER_GROUP even for last block group
/*
* We cannot get new block beyond end_blk for for the last block group
* so we can check with EXT2_BLOCKS_PER_GROUP even for last block group
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 375639a..d6fc533 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -408,8 +408,7 @@ retry:
fs->inode_map);
if (retval) goto errout;

fs->inode_map);
if (retval) goto errout;
- real_end = (((blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super) *
- fs->group_desc_count)) - 1 +
+ real_end = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count) - 1 +
fs->super->s_first_data_block;
retval = ext2fs_resize_block_bitmap2(new_size - 1,
real_end, fs->block_map);
fs->super->s_first_data_block;
retval = ext2fs_resize_block_bitmap2(new_size - 1,
real_end, fs->block_map);
@@ -2073,7 +2072,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
fs->super->s_free_inodes_count;
blks_needed = ext2fs_div_ceil(inode_count,
fs->super->s_inodes_per_group) *
fs->super->s_free_inodes_count;
blks_needed = ext2fs_div_ceil(inode_count,
fs->super->s_inodes_per_group) *
- EXT2_BLOCKS_PER_GROUP(fs->super);
+ (blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super);
groups = ext2fs_div64_ceil(blks_needed,
EXT2_BLOCKS_PER_GROUP(fs->super));
groups = ext2fs_div64_ceil(blks_needed,
EXT2_BLOCKS_PER_GROUP(fs->super));
#ifdef RESIZE2FS_DEBUG
@@ -2117,7 +2116,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
* figure out how many data blocks we have given the number of groups
* we need for our inodes
*/
* figure out how many data blocks we have given the number of groups
* we need for our inodes
*/
- data_blocks = groups * EXT2_BLOCKS_PER_GROUP(fs->super);
+ data_blocks = EXT2_GROUPS_TO_BLOCKS(fs->super, groups);
last_start = 0;
for (grp = 0; grp < groups; grp++) {
overhead = calc_group_overhead(fs, grp, old_desc_blocks);
last_start = 0;
for (grp = 0; grp < groups; grp++) {
overhead = calc_group_overhead(fs, grp, old_desc_blocks);
@@ -2151,7 +2150,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
extra_grps = ext2fs_div64_ceil(remainder,
EXT2_BLOCKS_PER_GROUP(fs->super));

extra_grps = ext2fs_div64_ceil(remainder,
EXT2_BLOCKS_PER_GROUP(fs->super));
- data_blocks += extra_grps * EXT2_BLOCKS_PER_GROUP(fs->super);
+ data_blocks += EXT2_GROUPS_TO_BLOCKS(fs->super, extra_grps);

/* ok we have to account for the last group */
overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
/* ok we have to account for the last group */
overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
@@ -2241,7 +2240,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
* only do groups-1, and then add the number of blocks needed to
* handle the group descriptor metadata+data that we need
*/
* only do groups-1, and then add the number of blocks needed to
* handle the group descriptor metadata+data that we need
*/
- blks_needed = (groups-1) * EXT2_BLOCKS_PER_GROUP(fs->super);
+ blks_needed = EXT2_GROUPS_TO_BLOCKS(fs->super, groups - 1);
blks_needed += overhead;

/*
--
blks_needed += overhead;
/*
--
2.7.5


33
SOURCES/e2fsprogs-1.42.11-e2fsck-free-ctx-fs-not-fs-at-the-end-of-fsck.patch

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
From a82d88ea99d3c5c21bf538b886da0482bf143fd5 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 24 Jul 2014 21:03:54 -0400
Subject: [PATCH] e2fsck: free ctx->fs, not fs, at the end of fsck

When we call ext2fs_close_free at the end of main(), we need to supply
the address of ctx->fs, because the subsequent e2fsck_free_context
call will try to access ctx->fs (which is now set to a freed block) to
see if it should free the directory block list. This is clearly not
desirable, so fix the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 8d1bdf3e..fc05bdee 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1774,7 +1774,7 @@ no_journal:
io_channel_flush(ctx->fs->io);
print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
free(ctx->journal_name);
e2fsck_free_context(ctx);
--
2.20.1

34
SOURCES/e2fsprogs-1.42.9-14-Clarify-how-the-description-of-the-dir_nlink-feature.patch

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
From 72f9ce9c2e6b7b41963c36096d3955e010df9033 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sun, 23 Jul 2017 18:51:22 -0400
Subject: [PATCH 1/2] Clarify how the description of the dir_nlink feature in
the ext4 man page

commit 7d8f358cdce948df57b1001b9c278f33519afa86

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/ext4.5.in | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/misc/ext4.5.in b/misc/ext4.5.in
index dcef6c08..366916d8 100644
--- a/misc/ext4.5.in
+++ b/misc/ext4.5.in
@@ -68,7 +68,12 @@ ext2 file systems.
.TP
.B dir_nlink
.br
-This ext4 feature allows more than 65000 subdirectories per directory.
+Normally ext4 allows an inode to have no more than 65,000 hard links.
+This applies to files as well as directories, which means that there can
+be no more than 64,998 subdirectories in a directory (because each of
+the '..' entries counts as a hard link). This feature lifts this limit
+by causing ext4 to use a links count of 1 to indicate that the number of
+hard links to a directory is not known.
.TP
.B extent
.br
--
2.20.1

32
SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-fd-leak-in-reserve_stdio_fds.patch

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
From a2a3247ba03bcb37f80b04b473112079968b9513 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 11 Aug 2018 20:47:08 -0400
Subject: [PATCH 10/16] e2fsck: fix fd leak in reserve_stdio_fds

commit ac5936d78d520b9edac15994728bb8b0364814e6

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
---
e2fsck/unix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 5fcc9d99..a434f1e6 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -604,9 +604,10 @@ static void reserve_stdio_fds(void)
fprintf(stderr, _("ERROR: Couldn't open "
"/dev/null (%s)\n"),
strerror(errno));
- break;
+ return;
}
}
+ (void) close(fd);
}
#ifdef HAVE_SIGNAL_H
--
2.20.1

51
SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-free-pointer-dereferences.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
From 6efb6613deeca55b8e5673c77644890e7f5e4738 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 8 Oct 2014 11:18:41 -0400
Subject: [PATCH 13/16] e2fsck: fix free pointer dereferences

commit ebdf895b43a1ce499e4d2556a201e2a753fc422f

Commit 47fee2ef6a23a introduces some free pointer dereference bugs by
not clearing ctx->fs after calling ext2fs_close_free().

Reported-by: Matthias Andree <mandree@FreeBSD.org>
Cc: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/unix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 84b9a454..bbf65d90 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -458,7 +458,7 @@ static void check_if_skip(e2fsck_t ctx)
}
log_out(ctx, "\n");
skip:
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
e2fsck_free_context(ctx);
exit(FSCK_OK);
}
@@ -1461,7 +1461,7 @@ failure:
/*
* Restart in order to reopen fs but this time start mmp.
*/
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
flags &= ~EXT2_FLAG_SKIP_MMP;
goto restart;
}
@@ -1690,7 +1690,7 @@ no_journal:
_("while resetting context"));
fatal_error(ctx, 0);
}
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
goto restart;
}
if (run_result & E2F_FLAG_CANCEL) {
--
2.20.1

45
SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-last-mount-time-and-last-write-time-in-pr.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
From 0d70bb1ca641ac31c84130e2d701ea296bc059fb Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 4 Jul 2014 16:24:18 -0400
Subject: [PATCH 15/16] e2fsck: fix last mount time and last write time in
preen mode

commit 87aca2ad028b9841d3ec32edd858ccc91d96ab4c

Fixing last mount time and last write time is safe - there's no risk of
loosing any important information or making corruption significantly
worse even if we get it wrong. So let's just fix these times in preen
mode. This allows initrd to automatically check and mount root
filesystem in case system clock is wrong without having to manually set
broken_system_clock variable (openSUSE uses broken_system_clock by default
to avoid these problems during boot but this disables time-based checks
even on systems where clock is fine so that's not ideal either).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/problem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index a01b2560..1aac7851 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -336,12 +336,12 @@ static struct e2fsck_problem problem_table[] = {
/* Last mount time is in the future */
{ PR_0_FUTURE_SB_LAST_MOUNT,
N_("@S last mount time (%t,\n\tnow = %T) is in the future.\n"),
- PROMPT_FIX, PR_NO_OK },
+ PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
/* Last write time is in the future */
{ PR_0_FUTURE_SB_LAST_WRITE,
N_("@S last write time (%t,\n\tnow = %T) is in the future.\n"),
- PROMPT_FIX, PR_NO_OK },
+ PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
{ PR_0_EXTERNAL_JOURNAL_HINT,
N_("@S hint for external superblock @s %X. "),
--
2.20.1

39
SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-off-by-one-bounds-check-on-group-number.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 2ab3543e3b3330317769adcbe4bdb2f3c0b855e9 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 24 Jul 2014 22:19:27 -0400
Subject: [PATCH 14/16] e2fsck: fix off-by-one bounds check on group number

commit b4f724c8a90987d4785fd1accfe69c125567be39

Since fs->group_desc_count is the number of block groups, the number
of the last group is always one less than this count. Fix the bounds
check to reflect that.

This flaw shouldn't have any user-visible side effects, since the
block bitmap test based on last_grp later on can handle overbig block
numbers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/pass1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 71b3000a..b58a0ca7 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2599,8 +2599,8 @@ static void new_table_block(e2fsck_t ctx, blk64_t first_block, dgrp_t group,
first_block = ext2fs_group_first_block2(fs,
flexbg_size * flexbg);
last_grp = group | (flexbg_size - 1);
- if (last_grp > fs->group_desc_count)
- last_grp = fs->group_desc_count;
+ if (last_grp >= fs->group_desc_count)
+ last_grp = fs->group_desc_count - 1;
last_block = ext2fs_group_last_block2(fs, last_grp);
} else
last_block = ext2fs_group_last_block2(fs, group);
--
2.20.1

66
SOURCES/e2fsprogs-1.42.9-14-e2fsck-fix-potential-Floating-Point-Exception-in-sho.patch

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
From 63eafe15eb224f1130d7e359db088fd620187ba6 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 12 Dec 2017 21:46:36 -0500
Subject: [PATCH 11/16] e2fsck: fix potential Floating Point Exception in
show_stats()

commit 53600d306dbb0eb901a04d76a4a97f45777d39c8

If the free inodes count in the superblock is equal to the inodes
count in the superblock (which is not possible with a valid file
system and will be fixed by e2fsck unless it is prevented by, for
example, e2fsck -n), it is possible for e2fsck to crash due to a
divide by zero error.

Fix this potential bug.

Addresses-Debian-Bug: #879220

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/unix.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index a434f1e6..84b9a454 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -103,7 +103,7 @@ static void show_stats(e2fsck_t ctx)
unsigned int dir_links;
unsigned int num_files, num_links;
__u32 *mask, m;
- int frag_percent_file, frag_percent_dir, frag_percent_total;
+ int frag_percent_file = 0, frag_percent_dir = 0, frag_percent_total = 0;
int i, j, printed = 0;
dir_links = 2 * ctx->fs_directory_count - 1;
@@ -116,16 +116,18 @@ static void show_stats(e2fsck_t ctx)
blocks_used = (ext2fs_blocks_count(fs->super) -
ext2fs_free_blocks_count(fs->super));
- frag_percent_file = (10000 * ctx->fs_fragmented) / inodes_used;
- frag_percent_file = (frag_percent_file + 5) / 10;
+ if (inodes_used > 0) {
+ frag_percent_file = (10000 * ctx->fs_fragmented) / inodes_used;
+ frag_percent_file = (frag_percent_file + 5) / 10;
- frag_percent_dir = (10000 * ctx->fs_fragmented_dir) / inodes_used;
- frag_percent_dir = (frag_percent_dir + 5) / 10;
+ frag_percent_dir = (10000 * ctx->fs_fragmented_dir) / inodes_used;
+ frag_percent_dir = (frag_percent_dir + 5) / 10;
- frag_percent_total = ((10000 * (ctx->fs_fragmented +
- ctx->fs_fragmented_dir))
- / inodes_used);
- frag_percent_total = (frag_percent_total + 5) / 10;
+ frag_percent_total = ((10000 * (ctx->fs_fragmented +
+ ctx->fs_fragmented_dir))
+ / inodes_used);
+ frag_percent_total = (frag_percent_total + 5) / 10;
+ }
if (!verbose) {
log_out(ctx, _("%s: %u/%u files (%0d.%d%% non-contiguous), "
--
2.20.1

64
SOURCES/e2fsprogs-1.42.9-14-e2fsck-if-any-problems-are-fixed-in-pass-0-check-the.patch

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
From 775ecc1dd6624fe9bb4c4769cbd4d2cf7f49ca64 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 26 Apr 2014 23:14:47 -0400
Subject: [PATCH 16/16] e2fsck: if any problems are fixed in pass 0, check the
whole file system

commit 7664c7538a11ca03d569008e6c999d525b6ea8ed

If there are any PREEN_OK problems fixed in check_super_block(), don't
skip checking the full file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/e2fsck.h | 3 ++-
e2fsck/problem.c | 3 +++
e2fsck/unix.c | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 913a596a..8fc99932 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -189,8 +189,9 @@ struct resource_track {
#define E2F_FLAG_GOT_DEVSIZE 0x0800 /* Device size has been fetched */
#define E2F_FLAG_EXITING 0x1000 /* E2fsck exiting due to errors */
#define E2F_FLAG_TIME_INSANE 0x2000 /* Time is insane */
+#define E2F_FLAG_PROBLEMS_FIXED 0x4000 /* At least one problem was fixed */
-#define E2F_RESET_FLAGS (E2F_FLAG_TIME_INSANE)
+#define E2F_RESET_FLAGS (E2F_FLAG_TIME_INSANE | E2F_FLAG_PROBLEMS_FIXED)
/*
* Defines for indicating the e2fsck pass number
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 1aac7851..c3ba631b 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1976,6 +1976,9 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
if (ptr->flags & PR_AFTER_CODE)
answer = fix_problem(ctx, ptr->second_code, pctx);
+ if (answer && (ptr->prompt != PROMPT_NONE))
+ ctx->flags |= E2F_FLAG_PROBLEMS_FIXED;
+
return answer;
}
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index bbf65d90..813fb8c5 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -339,6 +339,9 @@ static void check_if_skip(e2fsck_t ctx)
int broken_system_clock;
time_t lastcheck;
+ if (ctx->flags & E2F_FLAG_PROBLEMS_FIXED)
+ return;
+
profile_get_boolean(ctx->profile, "options", "broken_system_clock",
0, 0, &broken_system_clock);
if (ctx->flags & E2F_FLAG_TIME_INSANE)
--
2.20.1

81
SOURCES/e2fsprogs-1.42.9-14-e2fsck-remove-resize-inode-if-both-resize_inode-and-.patch

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
From e9d972c483d98b6b6fc9251166a1f5c2ca37ac5e Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Wed, 8 Aug 2018 13:52:56 +0200
Subject: [PATCH 06/16] e2fsck: remove resize inode if both resize_inode and
meta_bg are enabled

commit 74848259f0dd42bd478f0541c94f31ccd68eac3c

Previous e2fsprogs versions allowed to create a file system with both
resize_inode and meta_bg enabled. This was fixed by upstream commit
42e77d5d ("libext2fs: don't create filesystems with meta_bg and resize_inode")

However e2fsck still does not recognize the conflict and will attempt to
clear and recreate resize_inode if it's corrupted due to this incompatible
feature combination, though it will create it in the same wrong layout.

Fix it by teaching e2fsck to recognize resize_inode and meta_bg
conflict and fixing it by disabling and clearing resize inode.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/problem.c | 6 ++++++
e2fsck/problem.h | 3 +++
e2fsck/super.c | 8 ++++++++
3 files changed, 17 insertions(+)

diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 83584a08..a01b2560 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -438,6 +438,12 @@ 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},
+ /* Meta_bg and resize_inode are not compatible, disable resize_inode*/
+ { PR_0_DISABLE_RESIZE_INODE,
+ N_("Resize_@i and meta_bg features are enabled. Those features are\n"
+ "not compatible. Resize @i should be disabled. "),
+ PROMPT_FIX, 0 },
+
/* Pass 1 errors */
/* Pass 1: Checking inodes, blocks, and sizes */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 6cb09cfb..cf2df8ce 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -252,6 +252,9 @@ struct problem_context {
/* 64bit is set but extents are not set. */
#define PR_0_64BIT_WITHOUT_EXTENTS 0x000048
+/* Meta_bg and resize_inode are not compatible, remove resize_inode*/
+#define PR_0_DISABLE_RESIZE_INODE 0x000051
+
/*
* Pass 1 errors
*/
diff --git a/e2fsck/super.c b/e2fsck/super.c
index a6be3c69..7e2c2e4f 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -326,6 +326,14 @@ void check_resize_inode(e2fsck_t ctx)
clear_problem_context(&pctx);
+ if (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE &&
+ fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG &&
+ fix_problem(ctx, PR_0_DISABLE_RESIZE_INODE, &pctx)) {
+ fs->super->s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
+ fs->super->s_reserved_gdt_blocks = 0;
+ ext2fs_mark_super_dirty(fs);
+ }
+
/*
* If the resize inode feature isn't set, then
* s_reserved_gdt_blocks must be zero.
--
2.20.1

101
SOURCES/e2fsprogs-1.42.9-14-e2fsck-set-dir_nlink-feature-if-large-dir-exists.patch

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
From 458939e5d9441448f87d3a6d45c84e041ee14786 Mon Sep 17 00:00:00 2001
From: Andreas Dilger <adilger@dilger.ca>
Date: Fri, 22 Jun 2018 18:08:54 -0400
Subject: [PATCH 2/2] e2fsck: set dir_nlink feature if large dir exists

commit 1a8015773a9316ee90f713c275fb3a38731735e4

If there is a directory with more than EXT2_LINK_MAX (65000)
subdirectories, but the DIR_NLINK feature is not set in the
superblock, the feature should be set before continuing on
to change the on-disk directory link count to 1.

While most filesystems should have DIR_NLINK set (it was set
by default for all ext4 filesystems, and all kernels between
2.6.23 and 4.12 automatically set it if the directory link
count grew too large), it is possible that this flag is lost
due to disk corruption or for an upgraded filesystem. We no
longer want kernels to automatically enable features.

Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=196405
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/pass4.c | 14 +++++++++++++-
e2fsck/problem.c | 5 +++++
e2fsck/problem.h | 3 +++
3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c
index 21d93f0c..ad95227c 100644
--- a/e2fsck/pass4.c
+++ b/e2fsck/pass4.c
@@ -98,6 +98,7 @@ void e2fsck_pass4(e2fsck_t ctx)
#endif
struct problem_context pctx;
__u16 link_count, link_counted;
+ int dir_nlink_fs;
char *buf = 0;
dgrp_t group, maxgroup;
@@ -112,6 +113,9 @@ void e2fsck_pass4(e2fsck_t ctx)
if (!(ctx->options & E2F_OPT_PREEN))
fix_problem(ctx, PR_4_PASS_HEADER, &pctx);
+ dir_nlink_fs = EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_RO_COMPAT_DIR_NLINK);
+
group = 0;
maxgroup = fs->group_desc_count;
if (ctx->progress)
@@ -158,8 +162,16 @@ void e2fsck_pass4(e2fsck_t ctx)
&link_counted);
}
isdir = ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i);
- if (isdir && (link_counted > EXT2_LINK_MAX))
+ if (isdir && (link_counted > EXT2_LINK_MAX)) {
+ if (!dir_nlink_fs &&
+ fix_problem(ctx, PR_4_DIR_NLINK_FEATURE, &pctx)) {
+ fs->super->s_feature_ro_compat |=
+ EXT4_FEATURE_RO_COMPAT_DIR_NLINK;
+ ext2fs_mark_super_dirty(fs);
+ dir_nlink_fs = 1;
+ }
link_counted = 1;
+ }
if (link_counted != link_count) {
e2fsck_read_inode(ctx, i, inode, "pass4");
pctx.ino = i;
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index c3ba631b..0210ff8f 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1576,6 +1576,11 @@ static struct e2fsck_problem problem_table[] = {
"They @s the same!\n"),
PROMPT_NONE, 0 },
+ /* directory exceeds max links, but no DIR_NLINK feature in superblock*/
+ { PR_4_DIR_NLINK_FEATURE,
+ N_("@d exceeds max links, but no DIR_NLINK feature in @S.\n"),
+ PROMPT_FIX, 0 },
+
/* Pass 5 errors */
/* Pass 5: Checking group summary information */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index cf2df8ce..5712de59 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -1040,6 +1040,9 @@ struct problem_context {
/* Update quota information if it is inconsistent */
#define PR_6_UPDATE_QUOTAS 0x060002
+/* directory exceeds max links, but no DIR_NLINK feature in superblock */
+#define PR_4_DIR_NLINK_FEATURE 0x040006
+
/*
* Function declarations
*/
--
2.20.1

439
SOURCES/e2fsprogs-1.42.9-14-e2fsprogs-introduce-ext2fs_close_free-helper.patch

@ -0,0 +1,439 @@ @@ -0,0 +1,439 @@
From 868d26ab9b54545a67150ba59a5aa9d47cb4e2d8 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 20 Feb 2014 16:02:29 +0100
Subject: [PATCH 01/16] e2fsprogs: introduce ext2fs_close_free() helper

commit 47fee2ef6a23ae06f680336ffde57caa64604a4c

Currently there are many uses of ext2fs_close() which might be wrong.
First of all ext2fs_close() does not set the ext2_filsys pointer to NULL
so the caller is responsible for clearing it, however there are some
cases there we do not do it.

Second of all very small number of users of ext2fs_close() actually
check the return value. If there is a problem in ext2fs_close() it will
not even free the ext2_filsys structure, but majority of users expect it
to do so.

To fix both problems this commit introduces a new helper
ext2fs_close_free() which will not only check for the return value and
free the ext2_filsys structure if the call to ext2fs_close2() failed,
but it will also set the ext2_filsys pointer to NULL.

Replace every use of ext2fs_close() in e2fsprogs tools with
ext2fs_close_free() - there is no real reason to keep using
ext2fs_close().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
debugfs/debugfs.c | 6 ++----
e2fsck/scantest.c | 2 +-
e2fsck/unix.c | 20 ++++++++------------
e2fsck/util.c | 2 +-
lib/ext2fs/closefs.c | 12 ++++++++++++
lib/ext2fs/ext2fs.h | 1 +
lib/ext2fs/mkjournal.c | 2 +-
lib/ext2fs/tst_bitmaps.c | 12 ++++--------
misc/dumpe2fs.c | 6 +++---
misc/e2freefrag.c | 2 +-
misc/e2image.c | 4 ++--
misc/e4defrag.c | 2 +-
misc/mke2fs.c | 8 ++++----
misc/tune2fs.c | 6 +++---
resize/main.c | 2 +-
resize/resize2fs.c | 2 +-
16 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index cf7670bc..2082309b 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -131,10 +131,9 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
return;
errout:
- retval = ext2fs_close(current_fs);
+ retval = ext2fs_close_free(&current_fs);
if (retval)
com_err(device, retval, "while trying to close filesystem");
- current_fs = NULL;
}
void do_open_filesys(int argc, char **argv)
@@ -237,10 +236,9 @@ static void close_filesystem(NOARGS)
if (retval)
com_err("ext2fs_write_block_bitmap", retval, 0);
}
- retval = ext2fs_close(current_fs);
+ retval = ext2fs_close_free(&current_fs);
if (retval)
com_err("ext2fs_close", retval, 0);
- current_fs = NULL;
return;
}
diff --git a/e2fsck/scantest.c b/e2fsck/scantest.c
index 16380b31..61311410 100644
--- a/e2fsck/scantest.c
+++ b/e2fsck/scantest.c
@@ -133,7 +133,7 @@ int main (int argc, char *argv[])
}
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
print_resource_track(&global_rtrack);
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index d94d5dcd..5fcc9d99 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -456,8 +456,7 @@ static void check_if_skip(e2fsck_t ctx)
}
log_out(ctx, "\n");
skip:
- ext2fs_close(fs);
- ctx->fs = NULL;
+ ext2fs_close_free(&fs);
e2fsck_free_context(ctx);
exit(FSCK_OK);
}
@@ -1303,12 +1302,12 @@ restart:
orig_superblock = ctx->superblock;
get_backup_sb(ctx, fs, ctx->filesystem_name, io_ptr);
if (fs)
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
orig_retval = retval;
retval = try_open_fs(ctx, flags, io_ptr, &fs);
if ((orig_retval == 0) && retval != 0) {
if (fs)
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
log_out(ctx, _("%s: %s while using the "
"backup blocks"),
ctx->program_name,
@@ -1402,7 +1401,7 @@ failure:
* reopen the filesystem after we get the device size.
*/
if (pctx.errcode == EBUSY) {
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
need_restart++;
pctx.errcode =
ext2fs_get_device_size2(ctx->filesystem_name,
@@ -1459,8 +1458,7 @@ failure:
/*
* Restart in order to reopen fs but this time start mmp.
*/
- ext2fs_close(fs);
- ctx->fs = NULL;
+ ext2fs_close_free(&fs);
flags &= ~EXT2_FLAG_SKIP_MMP;
goto restart;
}
@@ -1510,8 +1508,7 @@ failure:
ctx->device_name);
fatal_error(ctx, 0);
}
- ext2fs_close(ctx->fs);
- ctx->fs = 0;
+ ext2fs_close_free(&ctx->fs);
ctx->flags |= E2F_FLAG_RESTARTED;
goto restart;
}
@@ -1690,7 +1687,7 @@ no_journal:
_("while resetting context"));
fatal_error(ctx, 0);
}
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
goto restart;
}
if (run_result & E2F_FLAG_CANCEL) {
@@ -1772,8 +1769,7 @@ no_journal:
io_channel_flush(ctx->fs->io);
print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
- ext2fs_close(fs);
- ctx->fs = NULL;
+ ext2fs_close_free(&fs);
free(ctx->journal_name);
e2fsck_free_context(ctx);
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 9f920b2c..14c9ad48 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -319,7 +319,7 @@ void preenhalt(e2fsck_t ctx)
if (fs != NULL) {
fs->super->s_state |= EXT2_ERROR_FS;
ext2fs_mark_super_dirty(fs);
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
}
exit(FSCK_UNCORRECTED);
}
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 000ebd87..4db9e194 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -437,6 +437,18 @@ errout:
return retval;
}
+errcode_t ext2fs_close_free(ext2_filsys *fs_ptr)
+{
+ errcode_t ret;
+ ext2_filsys fs = *fs_ptr;
+
+ ret = ext2fs_close2(fs, 0);
+ if (ret)
+ ext2fs_free(fs);
+ *fs_ptr = NULL;
+ return ret;
+}
+
errcode_t ext2fs_close(ext2_filsys fs)
{
return ext2fs_close2(fs, 0);
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 380608b2..643b66c0 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -925,6 +925,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs);
/* closefs.c */
extern errcode_t ext2fs_close(ext2_filsys fs);
extern errcode_t ext2fs_close2(ext2_filsys fs, int flags);
+extern errcode_t ext2fs_close_free(ext2_filsys *fs);
extern errcode_t ext2fs_flush(ext2_filsys fs);
extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags);
extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block);
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index d09c4589..52dc99be 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -630,7 +630,7 @@ main(int argc, char **argv)
if (retval) {
printf("Warning, had trouble writing out superblocks.\n");
}
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
exit(0);
}
diff --git a/lib/ext2fs/tst_bitmaps.c b/lib/ext2fs/tst_bitmaps.c
index 57bfd6c8..3a6d1bdc 100644
--- a/lib/ext2fs/tst_bitmaps.c
+++ b/lib/ext2fs/tst_bitmaps.c
@@ -187,8 +187,7 @@ static void setup_filesystem(const char *name,
return;
errout:
- ext2fs_close(test_fs);
- test_fs = 0;
+ ext2fs_close_free(&test_fs);
}
void setup_cmd(int argc, char **argv)
@@ -199,10 +198,8 @@ void setup_cmd(int argc, char **argv)
unsigned int type = EXT2FS_BMAP64_BITARRAY;
int flags = EXT2_FLAG_64BITS;
- if (test_fs) {
- ext2fs_close(test_fs);
- test_fs = 0;
- }
+ if (test_fs)
+ ext2fs_close_free(&test_fs);
reset_getopt();
while ((c = getopt(argc, argv, "b:i:lt:")) != EOF) {
@@ -242,8 +239,7 @@ void close_cmd(int argc, char **argv)
if (check_fs_open(argv[0]))
return;
- ext2fs_close(test_fs);
- test_fs = 0;
+ ext2fs_close_free(&test_fs);
}
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index d4bde8e5..cc18ad83 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -614,7 +614,7 @@ int main (int argc, char ** argv)
if (fs->super->s_feature_incompat &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
print_journal_information(fs);
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
exit(0);
}
if ((fs->super->s_feature_compat &
@@ -623,7 +623,7 @@ int main (int argc, char ** argv)
print_inline_journal_information(fs);
list_bad_blocks(fs, 0);
if (header_only) {
- ext2fs_close (fs);
+ ext2fs_close_free(&fs);
exit (0);
}
retval = ext2fs_read_bitmaps (fs);
@@ -634,7 +634,7 @@ int main (int argc, char ** argv)
error_message(retval));
}
}
- ext2fs_close (fs);
+ ext2fs_close_free(&fs);
remove_error_table(&et_ext2_error_table);
exit (0);
}
diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
index 612ca445..bb72c70d 100644
--- a/misc/e2freefrag.c
+++ b/misc/e2freefrag.c
@@ -215,7 +215,7 @@ static errcode_t get_chunk_info(ext2_filsys fs, struct chunk_info *info,
static void close_device(char *device_name, ext2_filsys fs)
{
- int retval = ext2fs_close(fs);
+ int retval = ext2fs_close_free(&fs);
if (retval)
com_err(device_name, retval, "while closing the filesystem.\n");
diff --git a/misc/e2image.c b/misc/e2image.c
index 0537b0d8..98dafa3d 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -1415,7 +1415,7 @@ static void install_image(char *device, char *image_fn, int type)
}
close(fd);
- ext2fs_close (fs);
+ ext2fs_close_free(&fs);
}
static struct ext2_qcow2_hdr *check_qcow2_image(int *fd, char *name)
@@ -1648,7 +1648,7 @@ skip_device:
else
write_image_file(fs, fd);
- ext2fs_close (fs);
+ ext2fs_close_free(&fs);
if (check)
printf(_("%d blocks already contained the data to be copied.\n"),
skipped_blocks);
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 1ba3c53a..2c2034cf 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -1863,7 +1863,7 @@ int main(int argc, char *argv[])
feature_incompat = fs->super->s_feature_incompat;
log_groups_per_flex = fs->super->s_log_groups_per_flex;
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
}
switch (arg_type) {
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 8952a5fe..2787a127 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1662,7 +1662,7 @@ profile_error:
printf(_("Using journal device's blocksize: %d\n"), blocksize);
fs_param.s_log_block_size =
int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE);
- ext2fs_close(jfs);
+ ext2fs_close_free(&jfs);
}
if (optind < argc) {
@@ -2585,7 +2585,7 @@ int main (int argc, char *argv[])
if (fs->super->s_feature_incompat &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
create_journal_dev(fs);
- exit(ext2fs_close(fs) ? 1 : 0);
+ exit(ext2fs_close_free(&fs) ? 1 : 0);
}
if (bad_blocks_filename)
@@ -2702,7 +2702,7 @@ int main (int argc, char *argv[])
}
if (!quiet)
printf("%s", _("done\n"));
- ext2fs_close(jfs);
+ ext2fs_close_free(&jfs);
free(journal_device);
} else if ((journal_size) ||
(fs_param.s_feature_compat &
@@ -2761,7 +2761,7 @@ no_journal:
"filesystem accounting information: "));
checkinterval = fs->super->s_checkinterval;
max_mnt_count = fs->super->s_max_mnt_count;
- retval = ext2fs_close(fs);
+ retval = ext2fs_close_free(&fs);
if (retval) {
fprintf(stderr, "%s",
_("\nWarning, had trouble writing out superblocks.\n"));
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index d2aa125d..1bedca20 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -682,7 +682,7 @@ static int add_journal(ext2_filsys fs)
fflush(stdout);
retval = ext2fs_add_journal_device(fs, jfs);
- ext2fs_close(jfs);
+ ext2fs_close_free(&jfs);
if (retval) {
com_err(program_name, retval,
_("while adding filesystem to journal on %s"),
@@ -1987,7 +1987,7 @@ retry_open:
goto closefs;
}
if (io_ptr != io_ptr_orig) {
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
goto retry_open;
}
}
@@ -2267,5 +2267,5 @@ closefs:
exit(1);
}
- return (ext2fs_close(fs) ? 1 : 0);
+ return (ext2fs_close_free(&fs) ? 1 : 0);
}
diff --git a/resize/main.c b/resize/main.c
index 80903b22..3951b091 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -484,7 +484,7 @@ int main (int argc, char ** argv)
_("Please run 'e2fsck -fy %s' to fix the filesystem\n"
"after the aborted resize operation.\n"),
device_name);
- ext2fs_close(fs);
+ ext2fs_close_free(&fs);
exit(1);
}
printf(_("The filesystem on %s is now %llu blocks long.\n\n"),
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index d6fc5337..a73390de 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -195,7 +195,7 @@ errcode_t resize_fs(ext2_filsys fs, blk64_t *new_size, int flags,
rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
print_resource_track(rfs, &overall_track, fs->io);
- retval = ext2fs_close(rfs->new_fs);
+ retval = ext2fs_close_free(&rfs->new_fs);
if (retval)
goto errout;
--
2.20.1

31
SOURCES/e2fsprogs-1.42.9-14-filefrag-don-t-ignore-fsync-errors.patch

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
From c7dcdc70473f524caa4d758233155df79bb1195d Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Jun 2018 15:19:56 +0200
Subject: [PATCH 08/16] filefrag: don't ignore fsync errors

commit a691f8d844faca28524b7c55780873244a070be7

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/filefrag.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/filefrag.c b/misc/filefrag.c
index a050a226..1c16a2ef 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -274,8 +274,8 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
fm_ext.fe_flags = FIEMAP_EXTENT_MERGED;
}
- if (sync_file)
- fsync(fd);
+ if (sync_file && fsync(fd) != 0)
+ return -errno;
for (i = 0, logical = 0, *num_extents = 0, count = last_block = 0;
i < numblocks;
--
2.20.1

37
SOURCES/e2fsprogs-1.42.9-14-libext2fs-automatically-enable-meta_bg-to-avoid-fill.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
From 4198ce4de86d2144ce127bba0d263a005926acf2 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Sat, 24 Oct 2015 00:30:02 -0400
Subject: [PATCH 03/16] libext2fs: automatically enable meta_bg to avoid
filling up BG 0

commit 03940aac5492879ef365b07e69105a98f4dbabf9

If during formatting we'd lose more than 75% a block group to group
descriptors and other metadata, enable the meta_bg feature. This
enables us to create >500T filesystems with default options.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/initialize.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 3548c56c..0b8355d8 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -379,6 +379,11 @@ ipg_retry:
overhead = (int) (3 + fs->inode_blocks_per_group +
super->s_reserved_gdt_blocks);
+ /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
+ if (super->s_reserved_gdt_blocks + fs->desc_blocks >
+ super->s_blocks_per_group * 3 / 4)
+ fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
+
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
overhead++;
else
--
2.20.1

52
SOURCES/e2fsprogs-1.42.9-14-libext2fs-don-t-create-filesystems-with-meta_bg-and-.patch

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
From 1654b25737d2a4538964b290a75e251131fbf3c0 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 19 Jun 2018 10:45:16 -0400
Subject: [PATCH 04/16] libext2fs: don't create filesystems with meta_bg and
resize_inode

commit 42e77d5db53e3ec09b5dc507169d15de219799e3

ext2fs_initialize() may end up enabling meta_bg feature for filesystem
which have resize_inode. Such combination is invalid to make sure we
disable resize_inode when enabling meta_bg.

Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/initialize.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 0b8355d8..8f0af1fb 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -369,6 +369,13 @@ ipg_retry:
retval = EXT2_ET_RES_GDT_BLOCKS;
goto cleanup;
}
+ /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
+ if (super->s_reserved_gdt_blocks + fs->desc_blocks >
+ super->s_blocks_per_group * 3 / 4) {
+ fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
+ fs->super->s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
+ set_field(s_reserved_gdt_blocks, 0);
+ }
/*
* Calculate the maximum number of bookkeeping blocks per
@@ -379,11 +386,6 @@ ipg_retry:
overhead = (int) (3 + fs->inode_blocks_per_group +
super->s_reserved_gdt_blocks);
- /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
- if (super->s_reserved_gdt_blocks + fs->desc_blocks >
- super->s_blocks_per_group * 3 / 4)
- fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
-
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
overhead++;
else
--
2.20.1

44
SOURCES/e2fsprogs-1.42.9-14-libext2fs-fix-ext2fs_open2-error-for-meta_bg-image-f.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From fc9ed72f64b0e6689eaed1faa33e3a333b995bf7 Mon Sep 17 00:00:00 2001
From: Kazuya Mio <k-mio@sx.jp.nec.com>
Date: Sat, 17 Mar 2018 14:56:15 -0400
Subject: [PATCH 05/16] libext2fs: fix ext2fs_open2() error for meta_bg image
file

commit 8b061a641dff1a0becf645f8e6002de79b997b95

dumpe2fs/debugfs can examine the image file by using the -i option.
However, if meta_bg feature is enabled, dumpe2fs/debugfs cannot open
the image file.

$ dumpe2fs -i test.img
dumpe2fs: Attempt to read block from filesystem resulted in short read while trying to open test.img
Couldn't find valid filesystem superblock.

In case of specifying an image file, the location of block group descriptors
is the same as the case of default filesystem regardless of meta_bg feature.
So if EXT2_FLAG_IMAGE_FILE flag is set in ext2fs_open2(),
don't use the meta_bg handling.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/openfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index ba501e6a..200f7815 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -378,7 +378,8 @@ 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) &&
+ !(flags & EXT2_FLAG_IMAGE_FILE)) {
first_meta_bg = fs->super->s_first_meta_bg;
if (first_meta_bg > fs->desc_blocks)
first_meta_bg = fs->desc_blocks;
--
2.20.1

42
SOURCES/e2fsprogs-1.42.9-14-libext2fs-fix-maximum-bg-overhead-calculation-with-m.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 80f665e8365607a9885ca6a136cdeffacf9860d6 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Sat, 24 Oct 2015 00:24:57 -0400
Subject: [PATCH 02/16] libext2fs: fix maximum bg overhead calculation with
meta_bg enabled

commit 1abdd04eb1d19488493022f81c03f5b80aa7fcc7

When meta_bg is enabled at mkfs time, we put at most one group
descriptor block in each blockgroup. Unfortunately, the calculation
of max overhead per bg doesn't know this, so mkfs fails when it isn't
strictly necessary. Fix it, since Dave reported that he couldn't
create a 500TB ext4 filesystem.

Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/initialize.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 2db8b3c2..3548c56c 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -377,7 +377,12 @@ ipg_retry:
* table, and the reserved gdt blocks.
*/
overhead = (int) (3 + fs->inode_blocks_per_group +
- fs->desc_blocks + super->s_reserved_gdt_blocks);
+ super->s_reserved_gdt_blocks);
+
+ if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
+ overhead++;
+ else
+ overhead += fs->desc_blocks;
/* This can only happen if the user requested too many inodes */
if (overhead > super->s_blocks_per_group) {
--
2.20.1

100
SOURCES/e2fsprogs-1.42.9-14-misc-fix-Coverity-bugs.patch

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
From df9c49cb287a9cd79ee2589ddfa3db0bc1a9d97b Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Sat, 16 May 2015 18:32:33 -0400
Subject: [PATCH 12/16] misc: fix Coverity bugs

commit 63cd76d6ac3bb7f90c583f240fc75e657610f2ea

Fix Coverity bugs 1297093, 1297096, 1297489, 1297491, 1297493,
1297506, 1297507, 1297514, 1297516, and 1297517.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
debugfs/util.c | 2 +-
lib/e2p/feature.c | 4 ++--
lib/e2p/mntopts.c | 2 +-
misc/e4defrag.c | 4 +++-
misc/logsave.c | 2 +-
5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debugfs/util.c b/debugfs/util.c
index aafbc567..b355e5cd 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -373,7 +373,7 @@ int common_block_args_process(int argc, char *argv[],
return 1;
if (*block == 0) {
com_err(argv[0], 0, "Invalid block number 0");
- err = 1;
+ return 1;
}
if (argc > 2) {
diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c
index 96912638..d4f1bf1a 100644
--- a/lib/e2p/feature.c
+++ b/lib/e2p/feature.c
@@ -177,7 +177,7 @@ int e2p_string2feature(char *string, int *compat_type, unsigned int *mask)
if (string[9] == 0)
return 1;
num = strtol(string+9, &eptr, 10);
- if (num > 32 || num < 0)
+ if (num > 31 || num < 0)
return 1;
if (*eptr)
return 1;
@@ -251,7 +251,7 @@ int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask)
if (string[9] == 0)
return 1;
num = strtol(string+9, &eptr, 10);
- if (num > 32 || num < 0)
+ if (num > 31 || num < 0)
return 1;
if (*eptr)
return 1;
diff --git a/lib/e2p/mntopts.c b/lib/e2p/mntopts.c
index d56cc527..ff2e5de9 100644
--- a/lib/e2p/mntopts.c
+++ b/lib/e2p/mntopts.c
@@ -72,7 +72,7 @@ int e2p_string2mntopt(char *string, unsigned int *mask)
if (string[8] == 0)
return 1;
num = strtol(string+8, &eptr, 10);
- if (num > 32 || num < 0)
+ if (num > 31 || num < 0)
return 1;
if (*eptr)
return 1;
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 2c2034cf..99baeb7b 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -440,8 +440,10 @@ static int page_in_core(int fd, struct move_extent defrag_data,
*page_num = 0;
*page_num = (length + pagesize - 1) / pagesize;
*vec = (unsigned char *)calloc(*page_num, 1);
- if (*vec == NULL)
+ if (*vec == NULL) {
+ munmap(page, length);
return -1;
+ }
/* Get information on whether pages are in core */
if (mincore(page, (size_t)length, *vec) == -1 ||
diff --git a/misc/logsave.c b/misc/logsave.c
index 8612edfb..cd6037dd 100644
--- a/misc/logsave.c
+++ b/misc/logsave.c
@@ -219,7 +219,7 @@ static int run_program(char **argv)
sprintf(buffer, "died with signal %d\n",
WTERMSIG(status));
send_output(buffer, 0, SEND_BOTH);
- rc = 1;
+ return 1;
}
rc = 0;
}
--
2.20.1

44
SOURCES/e2fsprogs-1.42.9-14-mke2fs-Avoid-crashes-infinite-loops-for-absurdly-lar.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From f7da56758e5d15416339d640f79d6eee875d22a9 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 25 Oct 2016 14:08:59 -0400
Subject: [PATCH 09/16] mke2fs: Avoid crashes / infinite loops for absurdly
large devices

commit 101ef2e93c253ae62320628e8958067d2d2a4e2a

When a device reports absurdly high size, some arithmetics in mke2fs can
overflow (e.g. number of block descriptors) and we end in an infinite
loop. Fix that by checking and refusing insanely large devices.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/mke2fs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 2787a127..7cea0330 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1858,6 +1858,18 @@ profile_error:
EXT2_BLOCK_SIZE(&fs_param));
exit(1);
}
+ /*
+ * Guard against group descriptor count overflowing... Mostly to avoid
+ * strange results for absurdly large devices.
+ */
+ if (fs_blocks_count > ((1ULL << (fs_param.s_log_block_size + 3 + 32)) - 1)) {
+ fprintf(stderr, _("%s: Size of device (0x%llx blocks) %s "
+ "too big to create\n\t"
+ "a filesystem using a blocksize of %d.\n"),
+ program_name, fs_blocks_count, device_name,
+ EXT2_BLOCK_SIZE(&fs_param));
+ exit(1);
+ }
ext2fs_blocks_count_set(&fs_param, fs_blocks_count);
--
2.20.1

53
SOURCES/e2fsprogs-1.42.9-14-resize2fs-Remove-the-real-kilobytes-rant-from-man-pa.patch

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
From e8e0b3e9e8318064e38e4be108bc625f9258fb45 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 19 Jul 2018 10:39:38 +0200
Subject: [PATCH 07/16] resize2fs: Remove the real kilobytes rant from man page

commit 94f20cd51522dd718bc4a459ea65d72a722d1874

Remove the rant about the "real" kilobytes from the man page and just
make it more clear that the suffixed units are representing power-of-two
units as we do in mke2fs man page. Also add terabytes to the list.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
resize/resize2fs.8.in | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
index a1f3099b..78cb1212 100644
--- a/resize/resize2fs.8.in
+++ b/resize/resize2fs.8.in
@@ -41,24 +41,16 @@ If no units are specified, the units of the
parameter shall be the filesystem blocksize of the filesystem.
Optionally, the
.I size
-parameter may be suffixed by one of the following the units
-designators: 's', 'K', 'M', or 'G',
-for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively.
-The
+parameter may be suffixed by one of the following units
+designators: 'K', 'M', 'G', 'T' (either upper-case or lower-case) or 's'
+for power-of-two kilobytes, megabytes, gigabytes, terabytes or 512 byte
+sectors respectively. The
.I size
of the filesystem may never be larger than the size of the partition.
If
.I size
parameter is not specified, it will default to the size of the partition.
.PP
-Note: when kilobytes is used above, I mean
-.IR real ,
-power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
-folks insist should be the stupid-sounding ``kibibytes''. The same
-holds true for megabytes, also sometimes known as ``mebibytes'', or
-gigabytes, as the amazingly silly ``gibibytes''. Makes you want to
-gibber, doesn't it?
-.PP
The
.B resize2fs
program does not manipulate the size of partitions. If you wish to enlarge
--
2.20.1

29
SOURCES/e2fsprogs-1.42.9-Fix-typo-in-the-ext4-5-man-page.patch

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
From beed1a9f0e8357de209c2c1418ca7db5d18a14f4 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 9 Sep 2015 10:53:49 -0400
Subject: [PATCH 5/7] Fix typo in the ext4(5) man page

Addresses-Debian-Bug: #798425

RHBZ: 1720130
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/ext4.5.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/ext4.5.in b/misc/ext4.5.in
index 366916d8..b73046ca 100644
--- a/misc/ext4.5.in
+++ b/misc/ext4.5.in
@@ -6,7 +6,7 @@
.SH NAME
ext2 \- the second extended file system
.br
-ext2 \- the third extended file system
+ext3 \- the third extended file system
.br
ext4 \- the fourth extended file system
.SH DESCRIPTION
--
2.21.1

43
SOURCES/e2fsprogs-1.42.9-add-revision-to-the-is_before_linux_ver.patch

@ -13,19 +13,19 @@ index 2afcb05..e970bbe 100644 @@ -13,19 +13,19 @@ index 2afcb05..e970bbe 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -172,7 +172,8 @@ static int parse_version_number(const char *s)
return KERNEL_VERSION(major, minor, rev);
return KERNEL_VERSION(major, minor, rev);
}

-static int is_before_linux_ver(unsigned int major, unsigned int minor)
+static int is_before_linux_ver(unsigned int major, unsigned int minor,
+ unsigned int rev)
{
struct utsname ut;
static int linux_version_code = -1;
struct utsname ut;
static int linux_version_code = -1;
@@ -186,10 +187,11 @@ static int is_before_linux_ver(unsigned int major, unsigned int minor)
if (linux_version_code == 0)
return 0;

if (linux_version_code == 0)
return 0;
- return linux_version_code < KERNEL_VERSION(major, minor, 0);
+ return linux_version_code < KERNEL_VERSION(major, minor, rev);
}
@ -34,25 +34,26 @@ index 2afcb05..e970bbe 100644 @@ -34,25 +34,26 @@ index 2afcb05..e970bbe 100644
+static int is_before_linux_ver(unsigned int major, unsigned int minor,
+ unsigned int rev)
{
return 0;
return 0;
}
@@ -1394,7 +1396,7 @@ profile_error:
memset(&fs_param, 0, sizeof(struct ext2_super_block));
fs_param.s_rev_level = 1; /* Create revision 1 filesystems now */

memset(&fs_param, 0, sizeof(struct ext2_super_block));
fs_param.s_rev_level = 1; /* Create revision 1 filesystems now */
- if (is_before_linux_ver(2, 2))
+ if (is_before_linux_ver(2, 2, 0))
fs_param.s_rev_level = 0;

if (argc && *argv) {
fs_param.s_rev_level = 0;
if (argc && *argv) {
@@ -1803,7 +1805,7 @@ profile_error:

if (use_bsize == -1) {
use_bsize = sys_page_size;
if (use_bsize == -1) {
use_bsize = sys_page_size;
- if (is_before_linux_ver(2, 6) && use_bsize > 4096)
+ if (is_before_linux_ver(2, 6, 0) && use_bsize > 4096)
use_bsize = 4096;
}
if (lsector_size && use_bsize < lsector_size)
--
use_bsize = 4096;
}
if (lsector_size && use_bsize < lsector_size)
--
1.8.3.1


4
SOURCES/e2fsprogs-1.42.9-chattr-manpage-j-update.patch

@ -3,11 +3,11 @@ Author: Zheng Liu <wenqing.lz@taobao.com> @@ -3,11 +3,11 @@ Author: Zheng Liu <wenqing.lz@taobao.com>
Date: Wed Feb 12 12:28:29 2014 -0500

chattr: improve the description for 'j' option in manpage

Ext4 file system also supports to set/clear 'j' attribute, but it just
say that this option is only useful for ext3 in manpage. This commit
fixes it.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

14
SOURCES/e2fsprogs-1.42.9-chattr-manpage-reorder.patch

@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Fri Jul 4 23:02:59 2014 -0400

e2fsprogs: reorder flags in chattr(1)

The flags described in chattr usage() and the chattr(1) manpage
were in semi-random order, which makes it hard to ascertain
which flags might be missing or undocumented, and to locate
flags within the manpage.

Re-order the list of flags in alphanumeric order, and do
the same for the flag descriptions in the body of the manpage.

There should be no content changes here, just reordering
for consistency.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
@ -171,9 +171,9 @@ index 39a6016..d5a6a61 100644 @@ -171,9 +171,9 @@ index 39a6016..d5a6a61 100644
@@ -83,7 +83,7 @@ static unsigned long sf;
static void usage(void)
{
fprintf(stderr,
fprintf(stderr,
- _("Usage: %s [-RVf] [-+=AaCcDdeijsSu] [-v version] files...\n"),
+ _("Usage: %s [-RVf] [-+=aAcCdDeijsSu] [-v version] files...\n"),
program_name);
exit(1);
program_name);
exit(1);
}

16
SOURCES/e2fsprogs-1.42.9-chattr-manpage-update.patch

@ -3,21 +3,21 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,21 +3,21 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Fri Jul 4 23:03:14 2014 -0400

e2fsprogs: revise and extend chattr(1) and chattr usage()

The chattr(1) manpage and chattr usage() output were missing some flags.

Add those, and make some other minor cosmetic fixes.

(I've left out the 'B' (EXT2_COMPRBLK_FL) flag, because
it's not actually used anywhere, and I can't figure out
how it differs from 'c' (EXT2_COMPR_FL))

Also, because the matrix of filesystems & flags is quite large,
refer to filesystem-specific manpages for detailed discussion
of flags supported by those filesystems, rather than trying to
cover it all in this manpage. I'll send those manpage
updates to the appropriate lists a bit later.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
@ -183,9 +183,9 @@ index d5a6a61..f130108 100644 @@ -183,9 +183,9 @@ index d5a6a61..f130108 100644
@@ -83,7 +83,7 @@ static unsigned long sf;
static void usage(void)
{
fprintf(stderr,
fprintf(stderr,
- _("Usage: %s [-RVf] [-+=aAcCdDeijsSu] [-v version] files...\n"),
+ _("Usage: %s [-RVf] [-+=aAcCdDeijsStTu] [-v version] files...\n"),
program_name);
exit(1);
program_name);
exit(1);
}

18
SOURCES/e2fsprogs-1.42.9-defrag-backwards-files.patch

@ -3,7 +3,7 @@ Author: Darrick J. Wong <darrick.wong@oracle.com> @@ -3,7 +3,7 @@ Author: Darrick J. Wong <darrick.wong@oracle.com>
Date: Tue Jul 22 12:40:56 2014 -0400

e4defrag: backwards-allocated files should be defragmented too

Currently, e4defrag avoids increasing file fragmentation by comparing
the number of runs of physical extents of both the original and the
donor files. Unfortunately, there is a bug in the routine that counts
@ -11,13 +11,13 @@ Date: Tue Jul 22 12:40:56 2014 -0400 @@ -11,13 +11,13 @@ Date: Tue Jul 22 12:40:56 2014 -0400
of the extents. Therefore, a file whose blocks were allocated in
reverse order will be seen as only having one big physical extent, and
therefore will not be defragmented.

Fix the counting routine to consider logical extent offset so that we
defragment backwards-allocated files. This could be problematic if we
ever gain the ability to lay out logically sparse extents in a
physically contiguous manner, but presumably one wouldn't call defrag
on such a file.

Reported-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
@ -27,13 +27,13 @@ Index: e2fsprogs-1.42.9/misc/e4defrag.c @@ -27,13 +27,13 @@ Index: e2fsprogs-1.42.9/misc/e4defrag.c
--- e2fsprogs-1.42.9.orig/misc/e4defrag.c
+++ e2fsprogs-1.42.9/misc/e4defrag.c
@@ -941,7 +941,9 @@ static int get_physical_count(struct fie

do {
if ((ext_list_tmp->data.physical + ext_list_tmp->data.len)
do {
if ((ext_list_tmp->data.physical + ext_list_tmp->data.len)
- != ext_list_tmp->next->data.physical) {
+ != ext_list_tmp->next->data.physical ||
+ (ext_list_tmp->data.logical + ext_list_tmp->data.len)
+ != ext_list_tmp->next->data.logical) {
/* This extent and next extent are not continuous. */
ret++;
}
/* This extent and next extent are not continuous. */
ret++;
}

15
SOURCES/e2fsprogs-1.42.9-disable-resize_inode-feature-if-64bit-feature-is-enabled.patch

@ -39,14 +39,15 @@ index e970bbe..76ea60b 100644 @@ -39,14 +39,15 @@ index e970bbe..76ea60b 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1836,6 +1836,9 @@ profile_error:
* 32-bit vs 64-bit block number support.
*/
if ((fs_blocks_count > MAX_32_NUM) &&
* 32-bit vs 64-bit block number support.
*/
if ((fs_blocks_count > MAX_32_NUM) &&
+ (fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT))
+ fs_param.s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
+ if ((fs_blocks_count > MAX_32_NUM) &&
!(fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) &&
get_bool_from_profile(fs_types, "auto_64-bit_support", 0)) {
fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
--
!(fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) &&
get_bool_from_profile(fs_types, "auto_64-bit_support", 0)) {
fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
--
1.8.3.1


18
SOURCES/e2fsprogs-1.42.9-dont-require-fsck-for-resize-p.patch

@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@sandeen.net> @@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@sandeen.net>
Date: Sun Dec 14 19:08:59 2014 -0500

resize2fs: don't require fsck to print min size

My previous change ended up requiring that the filesystem
be fsck'd after the last mount, even if we are only querying
the minimum size. This is a bit draconian, and it burned
the Fedora installer, which wants to calculate minimum size
for every filesystem in the box at install time, which in turn
requires a full fsck of every filesystem.

Try this one more time, and separate out the tests to make things
a bit more clear. If we're only printing the min size, don't
require the fsck, as this is a bit less dangerous/critical.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

@ -23,9 +23,9 @@ Index: e2fsprogs-1.42.9/resize/main.c @@ -23,9 +23,9 @@ Index: e2fsprogs-1.42.9/resize/main.c
--- e2fsprogs-1.42.9.orig/resize/main.c
+++ e2fsprogs-1.42.9/resize/main.c
@@ -319,10 +319,30 @@ int main (int argc, char ** argv)
exit (1);
}

exit (1);
}
- if (!(mount_flags & EXT2_MF_MOUNTED)) {
- if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
- (fs->super->s_state & EXT2_ERROR_FS) ||
@ -54,6 +54,6 @@ Index: e2fsprogs-1.42.9/resize/main.c @@ -54,6 +54,6 @@ Index: e2fsprogs-1.42.9/resize/main.c
+ checkit = 1;
+
+ if (checkit) {
fprintf(stderr,
_("Please run 'e2fsck -f %s' first.\n\n"),
device_name);
fprintf(stderr,
_("Please run 'e2fsck -f %s' first.\n\n"),
device_name);

54
SOURCES/e2fsprogs-1.42.9-e2fsck-abort-if-there-is-a-corrupted-directory-block.patch

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
From bd2ce466bd00d2fcdbc5154754fc4711f3348a18 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Thu, 19 Dec 2019 19:37:34 -0500
Subject: [PATCH 1/7] e2fsck: abort if there is a corrupted directory block
when rehashing

In e2fsck pass 3a, when we are rehashing directories, at least in
theory, all of the directories should have had corruptions with
respect to directory entry structure fixed. However, it's possible
(for example, if the user declined a fix) that we can reach this stage
of processing with a corrupted directory entries.

So check for that case and don't try to process a corrupted directory
block so we don't run into trouble in mutate_name() if there is a
zero-length file name.

RHBZ: 1797731
Addresses: TALOS-2019-0973
Addresses: CVE-2019-5188
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/rehash.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index 3aafbb12..fbc4e558 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -129,6 +129,10 @@ static int fill_dir_block(ext2_filsys fs,
dir_offset += rec_len;
if (dirent->inode == 0)
continue;
+ if ((dirent->name_len & 0xFF) == 0) {
+ fd->err = EXT2_ET_DIR_CORRUPTED;
+ return BLOCK_ABORT;
+ }
if (!fd->compress && ((dirent->name_len&0xFF) == 1) &&
(dirent->name[0] == '.'))
continue;
@@ -367,6 +371,11 @@ static int duplicate_search_and_fix(e2fsck_t ctx, ext2_filsys fs,
}
memcpy(new_name, ent->dir->name, ent->dir->name_len & 0xFF);
new_len = ent->dir->name_len;
+ if ((new_len & 0xFF) == 0) {
+ /* should never happen */
+ ext2fs_unmark_valid(fs);
+ continue;
+ }
mutate_name(new_name, &new_len);
for (j=0; j < fd->num_array; j++) {
if ((i==j) ||
--
2.21.1

97
SOURCES/e2fsprogs-1.42.9-e2fsck-clarify-overflow-link-count-error-message.patch

@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
From 334cc898f177771a5f1ca14c181d6df775cc55ec Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 13 Feb 2020 11:15:56 +0100
Subject: [PATCH 7/7] e2fsck: clarify overflow link count error message

When directory link count is set to overflow value (1) but during pass 4
we find out the exact link count would fit, we either silently fix this
(which is not great because e2fsck then reports the fs was modified but
output doesn't indicate why in any way), or we report that link count is
wrong and ask whether we should fix it (in case -n option was
specified). The second case is even more misleading because it suggests
non-trivial fs corruption which then gets silently fixed on the next
run. Similarly to how we fix up other non-problems, just create a new
error message for the case directory link count is not overflown anymore
and always report it to clarify what is going on.

RHBZ: 1820048
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 4ebce13292f54c96f43dcb1bd1d5b8df5dc8749d)
---
e2fsck/pass4.c | 19 +++++++++++++++----
e2fsck/problem.c | 5 +++++
e2fsck/problem.h | 3 +++
3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c
index ad95227c..c9586dfb 100644
--- a/e2fsck/pass4.c
+++ b/e2fsck/pass4.c
@@ -173,6 +173,7 @@ void e2fsck_pass4(e2fsck_t ctx)
link_counted = 1;
}
if (link_counted != link_count) {
+ int fix_nlink = 0;
e2fsck_read_inode(ctx, i, inode, "pass4");
pctx.ino = i;
pctx.inode = inode;
@@ -185,10 +186,20 @@ void e2fsck_pass4(e2fsck_t ctx)
pctx.num = link_counted;
/* i_link_count was previously exceeded, but no longer
* is, fix this but don't consider it an error */
- if ((isdir && link_counted > 1 &&
- (inode->i_flags & EXT2_INDEX_FL) &&
- link_count == 1 && !(ctx->options & E2F_OPT_NO)) ||
- fix_problem(ctx, PR_4_BAD_REF_COUNT, &pctx)) {
+ if (isdir && link_counted > 1 &&
+ (inode->i_flags & EXT2_INDEX_FL) &&
+ link_count == 1) {
+ if ((ctx->options & E2F_OPT_READONLY) == 0) {
+ fix_nlink =
+ fix_problem(ctx,
+ PR_4_DIR_OVERFLOW_REF_COUNT,
+ &pctx);
+ }
+ } else {
+ fix_nlink = fix_problem(ctx, PR_4_BAD_REF_COUNT,
+ &pctx);
+ }
+ if (fix_nlink) {
inode->i_links_count = link_counted;
e2fsck_write_inode(ctx, i, inode, "pass4");
}
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 0210ff8f..2e41bb2e 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1581,6 +1581,11 @@ static struct e2fsck_problem problem_table[] = {
N_("@d exceeds max links, but no DIR_NLINK feature in @S.\n"),
PROMPT_FIX, 0 },
+ /* Directory inode ref count set to overflow but could be exact value */
+ { PR_4_DIR_OVERFLOW_REF_COUNT,
+ N_("@d @i %i ref count set to overflow but could be exact value %N. "),
+ PROMPT_FIX, PR_PREEN_OK, 0, 0, 0 },
+
/* Pass 5 errors */
/* Pass 5: Checking group summary information */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 5712de59..a591974e 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -948,6 +948,9 @@ struct problem_context {
/* Inconsistent inode count information cached */
#define PR_4_INCONSISTENT_COUNT 0x040004
+/* Directory ref count set to overflow but it doesn't have to be */
+#define PR_4_DIR_OVERFLOW_REF_COUNT 0x040007
+
/*
* Pass 5 errors
*/
--
2.21.1

48
SOURCES/e2fsprogs-1.42.9-e2fsck-don-t-try-to-rehash-a-deleted-directory.patch

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
From 16c22d11ac511d6b228db36b62c1567e9578f290 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Thu, 19 Dec 2019 19:45:06 -0500
Subject: [PATCH 2/7] e2fsck: don't try to rehash a deleted directory

If directory has been deleted in pass1[bcd] processing, then we
shouldn't try to rehash the directory in pass 3a when we try to
rehash/reoptimize directories.

RHBZ: 1797731
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/pass1b.c | 4 ++++
e2fsck/rehash.c | 3 +++
2 files changed, 7 insertions(+)

diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 13bd9e98..0e6c29ef 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -643,6 +643,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
if (ctx->inode_bad_map)
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
+ if (ctx->inode_reg_map)
+ ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
+ ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
+ ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
quota_data_sub(ctx->qctx, &dp->inode, ino,
pb.dup_blocks * fs->blocksize);
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index fbc4e558..6f65edf3 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -882,6 +882,9 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
}
if (ino == ctx->lost_and_found)
continue;
+ if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
+ continue;
+
pctx.dir = ino;
if (first) {
fix_problem(ctx, PR_3A_PASS_HEADER, &pctx);
--
2.21.1

228
SOURCES/e2fsprogs-1.42.9-e2image-fix-metadata-image-handling-on-big-endian-sy.patch

@ -0,0 +1,228 @@ @@ -0,0 +1,228 @@
From 8f575d0b2c297f09491093b9e7ba6b914639be71 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Mon, 9 Apr 2018 11:58:15 -0400
Subject: [PATCH 4/7] e2image: fix metadata image handling on big endian
systems

Currently e2image metadata image handling and creating is completely
broken on big endian systems. It just does not care about endianness at
all. This was uncovered With addition of i_bitmaps test, which is the
first test that actually tests e2image metadata image.

Fix it by making sure that all on-disk metadata that we write and read
to/from the metadata image is properly converted.

RHBZ: 1711880
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/imager.c | 41 +++++++++++++++++++++++++++++++++++++++++
lib/ext2fs/inode.c | 2 +-
lib/ext2fs/openfs.c | 4 ++--
lib/ext2fs/rw_bitmaps.c | 4 ++--
misc/e2image.c | 22 +++++++++++-----------
5 files changed, 57 insertions(+), 16 deletions(-)

diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c
index b643cc6f..6caca65b 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -194,6 +194,11 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
char *buf, *cp;
ssize_t actual;
errcode_t retval;
+#ifdef WORDS_BIGENDIAN
+ unsigned int groups_per_block;
+ struct ext2_group_desc *gdp;
+ int j;
+#endif
buf = malloc(fs->blocksize);
if (!buf)
@@ -203,7 +208,17 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
* Write out the superblock
*/
memset(buf, 0, fs->blocksize);
+#ifdef WORDS_BIGENDIAN
+ /*
+ * We're writing out superblock so let's convert
+ * it to little endian and then back if needed
+ */
+ ext2fs_swap_super(fs->super);
memcpy(buf, fs->super, SUPERBLOCK_SIZE);
+ ext2fs_swap_super(fs->super);
+#else
+ memcpy(buf, fs->super, SUPERBLOCK_SIZE);
+#endif
actual = write(fd, buf, fs->blocksize);
if (actual == -1) {
retval = errno;
@@ -217,8 +232,34 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
/*
* Now write out the block group descriptors
*/
+
cp = (char *) fs->group_desc;
+
+#ifdef WORDS_BIGENDIAN
+ /*
+ * Convert group descriptors to little endian and back
+ * if needed
+ */
+ groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
+ gdp = (struct ext2_group_desc *) cp;
+ for (j=0; j < groups_per_block*fs->desc_blocks; j++) {
+ gdp = ext2fs_group_desc(fs, fs->group_desc, j);
+ ext2fs_swap_group_desc2(fs, gdp);
+ }
+#endif
+
actual = write(fd, cp, fs->blocksize * fs->desc_blocks);
+
+
+#ifdef WORDS_BIGENDIAN
+ groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
+ gdp = (struct ext2_group_desc *) cp;
+ for (j=0; j < groups_per_block*fs->desc_blocks; j++) {
+ gdp = ext2fs_group_desc(fs, fs->group_desc, j);
+ ext2fs_swap_group_desc2(fs, gdp);
+ }
+#endif
+
if (actual == -1) {
retval = errno;
goto errout;
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 573a8fa5..4297ec12 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -560,7 +560,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
}
if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
inodes_per_block = fs->blocksize / EXT2_INODE_SIZE(fs->super);
- block_nr = fs->image_header->offset_inode / fs->blocksize;
+ block_nr = ext2fs_le32_to_cpu(fs->image_header->offset_inode) / fs->blocksize;
block_nr += (ino - 1) / inodes_per_block;
offset = ((ino - 1) % inodes_per_block) *
EXT2_INODE_SIZE(fs->super);
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 200f7815..384dbf0f 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -177,10 +177,10 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
fs->image_header);
if (retval)
goto cleanup;
- if (fs->image_header->magic_number != EXT2_ET_MAGIC_E2IMAGE)
+ if (ext2fs_le32_to_cpu(fs->image_header->magic_number) != EXT2_ET_MAGIC_E2IMAGE)
return EXT2_ET_MAGIC_E2IMAGE;
superblock = 1;
- block_size = fs->image_header->fs_blocksize;
+ block_size = ext2fs_le32_to_cpu(fs->image_header->fs_blocksize);
}
/*
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index ad1d8c80..0e7986b0 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -205,7 +205,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
ext2fs_free_mem(&buf);
if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
- blk = (fs->image_header->offset_inodemap / fs->blocksize);
+ blk = (ext2fs_le32_to_cpu(fs->image_header->offset_inodemap) / fs->blocksize);
ino_cnt = fs->super->s_inodes_count;
while (inode_nbytes > 0) {
retval = io_channel_read_blk64(fs->image_io, blk++,
@@ -223,7 +223,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
ino_cnt -= fs->blocksize << 3;
inode_nbytes -= fs->blocksize;
}
- blk = (fs->image_header->offset_blockmap /
+ blk = (ext2fs_le32_to_cpu(fs->image_header->offset_blockmap) /
fs->blocksize);
blk_cnt = EXT2_GROUPS_TO_CLUSTERS(fs->super,
fs->group_desc_count);
diff --git a/misc/e2image.c b/misc/e2image.c
index 98dafa3d..41e54636 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -232,7 +232,7 @@ static void write_image_file(ext2_filsys fs, int fd)
write_header(fd, NULL, sizeof(struct ext2_image_hdr), fs->blocksize);
memset(&hdr, 0, sizeof(struct ext2_image_hdr));
- hdr.offset_super = seek_relative(fd, 0);
+ hdr.offset_super = ext2fs_cpu_to_le32(seek_relative(fd, 0));
retval = ext2fs_image_super_write(fs, fd, 0);
if (retval) {
com_err(program_name, retval, "%s",
@@ -240,7 +240,7 @@ static void write_image_file(ext2_filsys fs, int fd)
exit(1);
}
- hdr.offset_inode = seek_relative(fd, 0);
+ hdr.offset_inode = ext2fs_cpu_to_le32(seek_relative(fd, 0));
retval = ext2fs_image_inode_write(fs, fd,
(fd != 1) ? IMAGER_FLAG_SPARSEWRITE : 0);
if (retval) {
@@ -249,7 +249,7 @@ static void write_image_file(ext2_filsys fs, int fd)
exit(1);
}
- hdr.offset_blockmap = seek_relative(fd, 0);
+ hdr.offset_blockmap = ext2fs_cpu_to_le32(seek_relative(fd, 0));
retval = ext2fs_image_bitmap_write(fs, fd, 0);
if (retval) {
com_err(program_name, retval, "%s",
@@ -257,7 +257,7 @@ static void write_image_file(ext2_filsys fs, int fd)
exit(1);
}
- hdr.offset_inodemap = seek_relative(fd, 0);
+ hdr.offset_inodemap = ext2fs_cpu_to_le32(seek_relative(fd, 0));
retval = ext2fs_image_bitmap_write(fs, fd, IMAGER_FLAG_INODEMAP);
if (retval) {
com_err(program_name, retval, "%s",
@@ -265,23 +265,23 @@ static void write_image_file(ext2_filsys fs, int fd)
exit(1);
}
- hdr.magic_number = EXT2_ET_MAGIC_E2IMAGE;
+ hdr.magic_number = ext2fs_cpu_to_le32(EXT2_ET_MAGIC_E2IMAGE);
strcpy(hdr.magic_descriptor, "Ext2 Image 1.0");
gethostname(hdr.fs_hostname, sizeof(hdr.fs_hostname));
strncpy(hdr.fs_device_name, device_name, sizeof(hdr.fs_device_name)-1);
hdr.fs_device_name[sizeof(hdr.fs_device_name) - 1] = 0;
- hdr.fs_blocksize = fs->blocksize;
+ hdr.fs_blocksize = ext2fs_cpu_to_le32(fs->blocksize);
if (stat(device_name, &st) == 0)
- hdr.fs_device = st.st_rdev;
+ hdr.fs_device = ext2fs_cpu_to_le32(st.st_rdev);
if (fstat(fd, &st) == 0) {
- hdr.image_device = st.st_dev;
- hdr.image_inode = st.st_ino;
+ hdr.image_device = ext2fs_cpu_to_le32(st.st_dev);
+ hdr.image_inode = ext2fs_cpu_to_le32(st.st_ino);
}
memcpy(hdr.fs_uuid, fs->super->s_uuid, sizeof(hdr.fs_uuid));
- hdr.image_time = time(0);
+ hdr.image_time = ext2fs_cpu_to_le32(time(0));
write_header(fd, &hdr, sizeof(struct ext2_image_hdr), fs->blocksize);
}
@@ -1406,7 +1406,7 @@ static void install_image(char *device, char *image_fn, int type)
ext2fs_rewrite_to_io(fs, io);
- seek_set(fd, fs->image_header->offset_inode);
+ seek_set(fd, ext2fs_le32_to_cpu(fs->image_header->offset_inode));
retval = ext2fs_image_inode_read(fs, fd, 0);
if (retval) {
--
2.21.1

15
SOURCES/e2fsprogs-1.42.9-enable-64bit-feature-by-default.patch

@ -18,14 +18,15 @@ index 0871f77..667800c 100644 @@ -18,14 +18,15 @@ index 0871f77..667800c 100644
--- a/misc/mke2fs.conf.in
+++ b/misc/mke2fs.conf.in
@@ -11,8 +11,7 @@
features = has_journal
}
ext4 = {
features = has_journal
}
ext4 = {
- features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
- auto_64-bit_support = 1
+ features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,64bit
inode_size = 256
}
ext4dev = {
--
inode_size = 256
}
ext4dev = {
--
1.8.3.1


15
SOURCES/e2fsprogs-1.42.9-enable-lazy_itable_init-on-newer-kernel-by-default.patch

@ -24,9 +24,9 @@ index 76ea60b..23a988e 100644 @@ -24,9 +24,9 @@ index 76ea60b..23a988e 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1998,7 +1998,15 @@ profile_error:
blocksize, sys_page_size);
}

blocksize, sys_page_size);
}
- lazy_itable_init = 0;
+ /*
+ * On newer kernels we do have lazy_itable_init support. So pick the
@ -37,8 +37,9 @@ index 76ea60b..23a988e 100644 @@ -37,8 +37,9 @@ index 76ea60b..23a988e 100644
+ else
+ lazy_itable_init = 1;
+
if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
lazy_itable_init = 1;

--
if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
lazy_itable_init = 1;
--
1.8.3.1


10
SOURCES/e2fsprogs-1.42.9-ext4-manpage-add-attrs.patch

@ -3,16 +3,16 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,16 +3,16 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Mon Aug 25 21:02:18 2014 -0400

e2fsprogs: add supported file attributes to ext4.5 manpage

The chattr(1) manpage now refers users to filesystem-specific
manpages for details on supported attributes, so add those to
ext4.5.

I've left out oddities like being able to set the compressed
or no-tail-packing flags, or setting data journaling on ext2.

That behavior seems like a bug, not a feature.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

@ -23,7 +23,7 @@ index 9112b3d..a862a34 100644 @@ -23,7 +23,7 @@ index 9112b3d..a862a34 100644
@@ -608,6 +608,37 @@ seriously cramp the system's style.)
.B i_version
Enable 64-bit inode version support. This option is off by default.

+.SH FILE ATTRIBUTES
+The ext2, ext3, and ext4 filesystems support setting the following file
+attributes on Linux systems using the

8
SOURCES/e2fsprogs-1.42.9-ext4-manpage-add-mountopts.patch

@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Fri Jul 4 23:07:36 2014 -0400

e2fsprogs: add mount options to ext4.5

This is a straight cut and paste from the util-linux
mount manpage to ext4.5 (with commented-out lines
removed).

It's pretty much impossible for util-linux to keep up
with every filesystem out there, and Karel has more than
once expressed a wish that mount options move into fs-specific
manpages.

So, here we go.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>


6
SOURCES/e2fsprogs-1.42.9-fix-endian-handling-of-ext3_extent_header.patch

@ -19,8 +19,8 @@ index 4163436..a18d705 100644 @@ -19,8 +19,8 @@ index 4163436..a18d705 100644
--- a/lib/ext2fs/ext3_extents.h
+++ b/lib/ext2fs/ext3_extents.h
@@ -106,15 +106,20 @@ struct ext3_ext_path {
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
#define EXT_HAS_FREE_INDEX(__path__) \
- ((__path__)->p_hdr->eh_entries < (__path__)->p_hdr->eh_max)
+ (ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \
@ -41,5 +41,5 @@ index 4163436..a18d705 100644 @@ -41,5 +41,5 @@ index 4163436..a18d705 100644
- (EXT_FIRST_INDEX((__hdr__)) + (__hdr__)->eh_max - 1)
+ (EXT_FIRST_INDEX((__hdr__)) + \
+ ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)

#endif /* _LINUX_EXT3_EXTENTS */

42
SOURCES/e2fsprogs-1.42.9-force-journal-remove.patch

@ -3,19 +3,19 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,19 +3,19 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Thu Feb 20 20:18:41 2014 -0500

tune2fs: allow removal of dirty journal with two "-f" options

Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the
journal if the needs_recovery flag is set; the manpage seems to indicate
that it should. And if you've lost an external journal and can no longer
replay it, how should one proceed?

Change tune2fs so that two "-f" options will allow removal of a dirty
journal from a filesystem, even if the filesystem needs recovery.

e2fsck can then do its best to pick up the pieces.

Addresses-Debian-Bug: #559301

Reported-by: Jim Faulkner <james.faulkner@yale.edu>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
@ -24,11 +24,11 @@ Index: e2fsprogs-1.42.9/misc/tune2fs.8.in @@ -24,11 +24,11 @@ Index: e2fsprogs-1.42.9/misc/tune2fs.8.in
===================================================================
--- e2fsprogs-1.42.9.orig/misc/tune2fs.8.in
+++ e2fsprogs-1.42.9/misc/tune2fs.8.in
@@ -248,7 +248,10 @@ option is useful when removing the
filesystem feature from a filesystem which has
@@ -248,7 +248,10 @@ option is useful when removing the
filesystem feature from a filesystem which has
an external journal (or is corrupted
such that it appears to have an external journal), but that
-external journal is not available.
such that it appears to have an external journal), but that
-external journal is not available.
+external journal is not available. If the filesystem appears to require
+journal replay, the
+.B \-f
@ -41,23 +41,23 @@ Index: e2fsprogs-1.42.9/misc/tune2fs.c @@ -41,23 +41,23 @@ Index: e2fsprogs-1.42.9/misc/tune2fs.c
--- e2fsprogs-1.42.9.orig/misc/tune2fs.c
+++ e2fsprogs-1.42.9/misc/tune2fs.c
@@ -436,8 +436,9 @@ static int update_feature_set(ext2_filsy
"read-only.\n"), stderr);
return 1;
}
"read-only.\n"), stderr);
return 1;
}
- if (sb->s_feature_incompat &
- EXT3_FEATURE_INCOMPAT_RECOVER) {
+ if ((sb->s_feature_incompat &
+ EXT3_FEATURE_INCOMPAT_RECOVER) &&
+ f_flag < 2) {
fputs(_("The needs_recovery flag is set. "
"Please run e2fsck before clearing\n"
"the has_journal flag.\n"), stderr);
fputs(_("The needs_recovery flag is set. "
"Please run e2fsck before clearing\n"
"the has_journal flag.\n"), stderr);
@@ -929,7 +930,7 @@ static void parse_tune2fs_options(int ar
open_flag |= EXT2_FLAG_RW;
break;
case 'f': /* Force */
open_flag |= EXT2_FLAG_RW;
break;
case 'f': /* Force */
- f_flag = 1;
+ f_flag++;
break;
case 'g':
resgid = strtoul(optarg, &tmp, 0);
break;
case 'g':
resgid = strtoul(optarg, &tmp, 0);

30
SOURCES/e2fsprogs-1.42.9-libext2fs-avoid-buffer-overflow.patch

@ -3,7 +3,7 @@ Author: Theodore Ts'o <tytso@mit.edu> @@ -3,7 +3,7 @@ Author: Theodore Ts'o <tytso@mit.edu>
Date: Sat Aug 9 12:24:54 2014 -0400

libext2fs: avoid buffer overflow if s_first_meta_bg is too big

If s_first_meta_bg is greater than the of number block group
descriptor blocks, then reading or writing the block group descriptors
will end up overruning the memory buffer allocated for the
@ -11,42 +11,42 @@ Date: Sat Aug 9 12:24:54 2014 -0400 @@ -11,42 +11,42 @@ Date: Sat Aug 9 12:24:54 2014 -0400
fs->desc_blocks. This doesn't correct the bad s_first_meta_bg value,
but it avoids causing the e2fsprogs userspace programs from
potentially crashing.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Index: e2fsprogs-1.42.9/lib/ext2fs/closefs.c
===================================================================
--- e2fsprogs-1.42.9.orig/lib/ext2fs/closefs.c
+++ e2fsprogs-1.42.9/lib/ext2fs/closefs.c
@@ -336,9 +336,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
* superblocks and group descriptors.
*/
group_ptr = (char *) group_shadow;
@@ -336,9 +336,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
* 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;
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;

ext2fs_numeric_progress_init(fs, &progress, NULL,
old_desc_blocks = fs->desc_blocks;
ext2fs_numeric_progress_init(fs, &progress, NULL,
Index: e2fsprogs-1.42.9/lib/ext2fs/openfs.c
===================================================================
--- e2fsprogs-1.42.9.orig/lib/ext2fs/openfs.c
+++ e2fsprogs-1.42.9/lib/ext2fs/openfs.c
@@ -348,9 +348,11 @@ errcode_t ext2fs_open2(const char *name,
#ifdef WORDS_BIGENDIAN
groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
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;
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+1,
first_meta_bg = fs->desc_blocks;
if (first_meta_bg) {
retval = io_channel_read_blk(fs->io, group_block+1,

38
SOURCES/e2fsprogs-1.42.9-libext2fs-buffer-overflow-closefs.patch

@ -3,49 +3,49 @@ Author: Theodore Ts'o <tytso@mit.edu> @@ -3,49 +3,49 @@ Author: Theodore Ts'o <tytso@mit.edu>
Date: Fri Feb 6 12:46:39 2015 -0500

libext2fs: fix potential buffer overflow in closefs()

The bug fix in f66e6ce4446: "libext2fs: avoid buffer overflow if
s_first_meta_bg is too big" had a typo in the fix for
ext2fs_closefs(). In practice most of the security exposure was from
the openfs path, since this meant if there was a carefully crafted
file system, buffer overrun would be triggered when the file system was
opened.

However, if corrupted file system didn't trip over some corruption
check, and then the file system was modified via tune2fs or debugfs,
such that the superblock was marked dirty and then written out via the
closefs() path, it's possible that the buffer overrun could be
triggered when the file system is closed.

Also clear up a signed vs unsigned warning while we're at it.

Thanks to Nick Kralevich <nnk@google.com> for asking me to look at
compiler warning in the code in question, which led me to notice the
bug in f66e6ce4446.

Addresses: CVE-2015-1572

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Index: e2fsprogs-1.42.9/lib/ext2fs/closefs.c
===================================================================
--- e2fsprogs-1.42.9.orig/lib/ext2fs/closefs.c
+++ e2fsprogs-1.42.9/lib/ext2fs/closefs.c
@@ -279,7 +279,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
dgrp_t j;
@@ -279,7 +279,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
dgrp_t j;
#endif
char *group_ptr;
char *group_ptr;
- int old_desc_blocks;
+ blk64_t old_desc_blocks;
struct ext2fs_numeric_progress_struct progress;

EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
@@ -338,7 +338,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
group_ptr = (char *) group_shadow;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
old_desc_blocks = fs->super->s_first_meta_bg;
struct ext2fs_numeric_progress_struct progress;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
@@ -338,7 +338,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
group_ptr = (char *) group_shadow;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
old_desc_blocks = fs->super->s_first_meta_bg;
- if (old_desc_blocks > fs->super->s_first_meta_bg)
+ if (old_desc_blocks > fs->desc_blocks)
old_desc_blocks = fs->desc_blocks;
} else
old_desc_blocks = fs->desc_blocks;
old_desc_blocks = fs->desc_blocks;
} else
old_desc_blocks = fs->desc_blocks;

25
SOURCES/e2fsprogs-1.42.9-libext2fs-detect-correct-superblock-adjustments-when.patch

@ -26,23 +26,23 @@ index 2c6e10e..b27bf19 100644 @@ -26,23 +26,23 @@ 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;
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
/*
* 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 &&
* 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;
ret_blk += fs->super->s_blocks_per_group;
- return ret_blk;
+
+ /*
@ -57,7 +57,8 @@ index 2c6e10e..b27bf19 100644 @@ -57,7 +57,8 @@ index 2c6e10e..b27bf19 100644
+ }
+ return ret_blk + has_super;
}

blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i)
--
--
2.17.1


71
SOURCES/e2fsprogs-1.42.9-libext2fs-don-t-always-read-backup-group-descriptors.patch

@ -30,29 +30,29 @@ index cb03ecf..380608b 100644 @@ -30,29 +30,29 @@ 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);
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);
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)
dgrp_t i)
{
int bg;
int bg;
- int has_super = 0;
+ int has_super = 0, group_zero_adjust = 0;
blk64_t ret_blk;

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.
@ -60,34 +60,34 @@ index b27bf19..ba501e6 100644 @@ -60,34 +60,34 @@ index b27bf19..ba501e6 100644
+ 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))
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))
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;
}
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;
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;
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;
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.
@ -99,21 +99,22 @@ index b27bf19..ba501e6 100644 @@ -99,21 +99,22 @@ index b27bf19..ba501e6 100644
+ * set superblock == 0 (i.e. auto-detect the superblock), which is
+ * what's going on here.
+ */
if (group_block == 0 && fs->blocksize == 1024)
if (group_block == 0 && fs->blocksize == 1024)
- group_block = 1; /* Deal with 1024 blocksize && bigalloc */
+ group_zero_adjust = 1;
dest = (char *) fs->group_desc;
dest = (char *) fs->group_desc;
#ifdef WORDS_BIGENDIAN
groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
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) {
} 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;
--
first_meta_bg, dest);
if (retval)
goto cleanup;
--
2.17.1


212
SOURCES/e2fsprogs-1.42.9-libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch

@ -0,0 +1,212 @@ @@ -0,0 +1,212 @@
From 94020540808683e648b56c795f1621cc6362054e Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sun, 1 Sep 2019 00:59:16 -0400
Subject: [PATCH 3/7] libsupport: add checks to prevent buffer overrun bugs in
quota code

A maliciously corrupted file systems can trigger buffer overruns in
the quota code used by e2fsck. To fix this, add sanity checks to the
quota header fields as well as to block number references in the quota
tree.

RHBZ: 1768710
Addresses: CVE-2019-5094
Addresses: TALOS-2019-0887
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/quota/mkquota.c | 1 +
lib/quota/quotaio_tree.c | 70 +++++++++++++++++++++++++++-------------
lib/quota/quotaio_v2.c | 28 ++++++++++++++++
3 files changed, 76 insertions(+), 23 deletions(-)

diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c
index 3aa81003..f1fc64a0 100644
--- a/lib/quota/mkquota.c
+++ b/lib/quota/mkquota.c
@@ -552,6 +552,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype,
err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
if (err) {
log_err("Error scanning dquots");
+ *usage_inconsistent = 1;
goto out;
}
*usage_inconsistent = scan_data.usage_is_inconsistent;
diff --git a/lib/quota/quotaio_tree.c b/lib/quota/quotaio_tree.c
index c1653a39..2579450e 100644
--- a/lib/quota/quotaio_tree.c
+++ b/lib/quota/quotaio_tree.c
@@ -534,6 +534,17 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
return dquot;
}
+static int check_reference(struct quota_handle *h, unsigned int blk)
+{
+ if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks) {
+ log_err("Illegal reference (%u >= %u) in %s quota file",
+ blk, h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
+ type2name(h->qh_type));
+ return -1;
+ }
+ return 0;
+}
+
/*
* Scan all dquots in file and call callback on each
*/
@@ -552,7 +563,7 @@ static int report_block(struct dquot *dquot, uint blk, char *bitmap,
int entries, i;
if (!buf)
- return 0;
+ return -1;
set_bit(bitmap, blk);
read_blk(dquot->dq_h, blk, buf);
@@ -574,22 +585,12 @@ static int report_block(struct dquot *dquot, uint blk, char *bitmap,
return entries;
}
-static void check_reference(struct quota_handle *h, uint blk)
-{
- if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks)
- log_err("Illegal reference (%u >= %u) in %s quota file. "
- "Quota file is probably corrupted.\n"
- "Please run e2fsck (8) to fix it.",
- blk,
- h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
- type2name(h->qh_type));
-}
static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
int (*process_dquot) (struct dquot *, void *),
void *data)
{
- int entries = 0, i;
+ int entries = 0, ret, i;
dqbuf_t buf = getdqbuf();
u_int32_t *ref = (u_int32_t *) buf;
@@ -600,22 +601,40 @@ static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
if (depth == QT_TREEDEPTH - 1) {
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
blk = ext2fs_le32_to_cpu(ref[i]);
- check_reference(dquot->dq_h, blk);
- if (blk && !get_bit(bitmap, blk))
- entries += report_block(dquot, blk, bitmap,
- process_dquot, data);
+ if (check_reference(dquot->dq_h, blk)) {
+ entries = -1;
+ goto errout;
+ }
+ if (blk && !get_bit(bitmap, blk)) {
+ ret = report_block(dquot, blk, bitmap,
+ process_dquot, data);
+ if (ret < 0) {
+ entries = ret;
+ goto errout;
+ }
+ entries += ret;
+ }
}
} else {
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
blk = ext2fs_le32_to_cpu(ref[i]);
if (blk) {
- check_reference(dquot->dq_h, blk);
- entries += report_tree(dquot, blk, depth + 1,
- bitmap, process_dquot,
- data);
+ if (check_reference(dquot->dq_h, blk)) {
+ entries = -1;
+ goto errout;
+ }
+ ret = report_tree(dquot, blk, depth + 1,
+ bitmap, process_dquot,
+ data);
+ if (ret < 0) {
+ entries = ret;
+ goto errout;
+ }
+ entries += ret;
}
}
}
+errout:
freedqbuf(buf);
return entries;
}
@@ -634,6 +653,7 @@ int qtree_scan_dquots(struct quota_handle *h,
int (*process_dquot) (struct dquot *, void *),
void *data)
{
+ int ret;
char *bitmap;
struct v2_mem_dqinfo *v2info = &h->qh_info.u.v2_mdqi;
struct qtree_mem_dqinfo *info = &v2info->dqi_qtree;
@@ -647,10 +667,14 @@ int qtree_scan_dquots(struct quota_handle *h,
ext2fs_free_mem(&dquot);
return -1;
}
- v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
- process_dquot, data);
+ ret = report_tree(dquot, QT_TREEOFF, 0, bitmap, process_dquot, data);
+ if (ret < 0)
+ goto errout;
+ v2info->dqi_used_entries = ret;
v2info->dqi_data_blocks = find_set_bits(bitmap, info->dqi_blocks);
+ ret = 0;
+errout:
ext2fs_free_mem(&bitmap);
ext2fs_free_mem(&dquot);
- return 0;
+ return ret;
}
diff --git a/lib/quota/quotaio_v2.c b/lib/quota/quotaio_v2.c
index e7bf29c3..8957d487 100644
--- a/lib/quota/quotaio_v2.c
+++ b/lib/quota/quotaio_v2.c
@@ -174,6 +174,8 @@ static int v2_check_file(struct quota_handle *h, int type, int fmt)
static int v2_init_io(struct quota_handle *h)
{
struct v2_disk_dqinfo ddqinfo;
+ struct v2_mem_dqinfo *info;
+ __u64 filesize;
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
sizeof(struct v2r1_disk_dqblk);
@@ -184,6 +186,32 @@ static int v2_init_io(struct quota_handle *h)
sizeof(ddqinfo)) != sizeof(ddqinfo))
return -1;
v2_disk2memdqinfo(&h->qh_info, &ddqinfo);
+
+ /* Check to make sure quota file info is sane */
+ info = &h->qh_info.u.v2_mdqi;
+ if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &filesize))
+ return -1;
+ if ((filesize > (1U << 31)) ||
+ (info->dqi_qtree.dqi_blocks >
+ (filesize + QT_BLKSIZE - 1) >> QT_BLKSIZE_BITS)) {
+ log_err("Quota inode %u corrupted: file size %llu; "
+ "dqi_blocks %u", h->qh_qf.ino,
+ filesize, info->dqi_qtree.dqi_blocks);
+ return -1;
+ }
+ if (info->dqi_qtree.dqi_free_blk >= info->dqi_qtree.dqi_blocks) {
+ log_err("Quota inode %u corrupted: free_blk %u; dqi_blocks %u",
+ h->qh_qf.ino, info->dqi_qtree.dqi_free_blk,
+ info->dqi_qtree.dqi_blocks);
+ return -1;
+ }
+ if (info->dqi_qtree.dqi_free_entry >= info->dqi_qtree.dqi_blocks) {
+ log_err("Quota inode %u corrupted: free_entry %u; "
+ "dqi_blocks %u", h->qh_qf.ino,
+ info->dqi_qtree.dqi_free_entry,
+ info->dqi_qtree.dqi_blocks);
+ return -1;
+ }
return 0;
}
--
2.21.1

49
SOURCES/e2fsprogs-1.42.9-mke2fs-clean-up-kernel-version-tests.patch

@ -26,9 +26,9 @@ index 2e8ba60..2afcb05 100644 @@ -26,9 +26,9 @@ index 2e8ba60..2afcb05 100644
#ifdef HAVE_GETOPT_H
#include <getopt.h>
@@ -168,7 +169,29 @@ static int parse_version_number(const char *s)
rev = strtol(cp, &endptr, 10);
if (cp == endptr)
return 0;
rev = strtol(cp, &endptr, 10);
if (cp == endptr)
return 0;
- return ((((major * 256) + minor) * 256) + rev);
+ return KERNEL_VERSION(major, minor, rev);
+}
@ -55,21 +55,21 @@ index 2e8ba60..2afcb05 100644 @@ -55,21 +55,21 @@ index 2e8ba60..2afcb05 100644
+ return 0;
}
#endif

@@ -1306,9 +1329,6 @@ static void PRS(int argc, char *argv[])
* Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs.
*/
blk64_t fs_blocks_count = 0;
* Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs.
*/
blk64_t fs_blocks_count = 0;
-#ifdef __linux__
- struct utsname ut;
-#endif
long sysval;
int s_opt = -1, r_opt = -1;
char *fs_features = 0;
long sysval;
int s_opt = -1, r_opt = -1;
char *fs_features = 0;
@@ -1374,15 +1394,8 @@ profile_error:
memset(&fs_param, 0, sizeof(struct ext2_super_block));
fs_param.s_rev_level = 1; /* Create revision 1 filesystems now */

memset(&fs_param, 0, sizeof(struct ext2_super_block));
fs_param.s_rev_level = 1; /* Create revision 1 filesystems now */
-#ifdef __linux__
- if (uname(&ut)) {
- perror("uname");
@ -78,20 +78,21 @@ index 2e8ba60..2afcb05 100644 @@ -78,20 +78,21 @@ index 2e8ba60..2afcb05 100644
- linux_version_code = parse_version_number(ut.release);
- if (linux_version_code && linux_version_code < (2*65536 + 2*256))
+ if (is_before_linux_ver(2, 2))
fs_param.s_rev_level = 0;
fs_param.s_rev_level = 0;
-#endif

if (argc && *argv) {
program_name = get_progname(*argv);
if (argc && *argv) {
program_name = get_progname(*argv);
@@ -1790,8 +1803,7 @@ profile_error:

if (use_bsize == -1) {
use_bsize = sys_page_size;
if (use_bsize == -1) {
use_bsize = sys_page_size;
- if ((linux_version_code < (2*65536 + 6*256)) &&
- (use_bsize > 4096))
+ if (is_before_linux_ver(2, 6) && use_bsize > 4096)
use_bsize = 4096;
}
if (lsector_size && use_bsize < lsector_size)
--
use_bsize = 4096;
}
if (lsector_size && use_bsize < lsector_size)
--
1.8.3.1


31
SOURCES/e2fsprogs-1.42.9-mke2fs.conf-Introduce-rhel6-fs_type.patch

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
From d01edcbdb6e151d425ecb1631e10a207e54e1fe5 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Mon, 4 May 2020 14:44:49 +0200
Subject: [PATCH 6/7] mke2fs.conf: Introduce rhel6 fs_type

RHBZ: 1780277
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
misc/mke2fs.conf.in | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/misc/mke2fs.conf.in b/misc/mke2fs.conf.in
index 667800c8..e074fd58 100644
--- a/misc/mke2fs.conf.in
+++ b/misc/mke2fs.conf.in
@@ -19,6 +19,12 @@
inode_size = 256
options = test_fs=1
}
+ rhel6_ext4 = {
+ features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
+ inode_size = 256
+ enable_periodic_fsck = 1
+ default_mntopts = ""
+ }
small = {
blocksize = 1024
inode_size = 128
--
2.21.1

20
SOURCES/e2fsprogs-1.42.9-mkfs-revision-too-high.patch

@ -3,17 +3,17 @@ Author: Frank Sorenson <fsorenso@redhat.com> @@ -3,17 +3,17 @@ Author: Frank Sorenson <fsorenso@redhat.com>
Date: Fri Jul 4 15:31:50 2014 -0400

mke2fs: prevent creation of filesystem with unsupported revision

It's a bit strange to accept revision levels higher than
the code creating the filesystem can understand, so don't
allow it.

At least the kernel will mount the fs readonly if it's too
high, but no other utility will touch it, so you can't
fix the error.

Just reject anything > EXT2_MAX_SUPP_REV at mkfs time.

Signed-off-by: Frank Sorenson <fsorenso@redhat.com>
[sandeen@redhat.com: Add more verbose commit log]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
@ -24,14 +24,14 @@ Index: e2fsprogs-1.42.9/misc/mke2fs.c @@ -24,14 +24,14 @@ Index: e2fsprogs-1.42.9/misc/mke2fs.c
--- e2fsprogs-1.42.9.orig/misc/mke2fs.c
+++ e2fsprogs-1.42.9/misc/mke2fs.c
@@ -1570,6 +1570,11 @@ profile_error:
_("bad revision level - %s"), optarg);
exit(1);
}
_("bad revision level - %s"), optarg);
exit(1);
}
+ if (r_opt > EXT2_MAX_SUPP_REV) {
+ com_err(program_name, EXT2_ET_REV_TOO_HIGH,
+ _("while trying to create revision %d"), r_opt);
+ exit(1);
+ }
fs_param.s_rev_level = r_opt;
break;
case 's': /* deprecated */
fs_param.s_rev_level = r_opt;
break;
case 's': /* deprecated */

8
SOURCES/e2fsprogs-1.42.9-no-ppc-altivec.patch

@ -3,13 +3,13 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/Makefile.in @@ -3,13 +3,13 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/Makefile.in
--- e2fsprogs-1.42.9.orig/lib/ext2fs/Makefile.in
+++ e2fsprogs-1.42.9/lib/ext2fs/Makefile.in
@@ -197,6 +197,10 @@ BSDLIB_INSTALL_DIR = $(root_libdir)

all:: ext2fs.pc

+ifdef PPC_NO_ALTIVEC
+ALL_CFLAGS += -mno-altivec -mno-vsx
+endif
+endif
+
.c.o:
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@

32
SOURCES/e2fsprogs-1.42.9-resize2fs-clear-uninit-BG.patch

@ -3,17 +3,17 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,17 +3,17 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Sun Mar 6 21:51:23 2016 -0500

resize2fs: clear uninit BG if allocating from new group

If resize2fs_get_alloc_block() allocates from a BLOCK_UNINIT group, we
need to make sure that the UNINIT flag is cleared on both file system
structures which are maintained by resize2fs. This causes the
modified bitmaps to not get written out, which leads to post-resize2fs
e2fsck errors; used blocks in UNINIT groups, not marked in the block
bitmap. This was seen on r_ext4_small_bg.

This patch uses clear_block_uninit() to clear the flag,
and my problem goes away.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
@ -25,7 +25,7 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/alloc.c @@ -25,7 +25,7 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/alloc.c
+++ e2fsprogs-1.42.9/lib/ext2fs/alloc.c
@@ -27,6 +27,22 @@
#include "ext2fs.h"

/*
+ * Clear the uninit block bitmap flag if necessary
+ */
@ -52,11 +52,11 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/ext2fs.h @@ -52,11 +52,11 @@ Index: e2fsprogs-1.42.9/lib/ext2fs/ext2fs.h
+++ e2fsprogs-1.42.9/lib/ext2fs/ext2fs.h
@@ -639,6 +639,7 @@ static inline int ext2fs_needs_large_fil
}

/* alloc.c */
+extern void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group);
extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
ext2fs_inode_bitmap map, ext2_ino_t *ret);
ext2fs_inode_bitmap map, ext2_ino_t *ret);
extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
Index: e2fsprogs-1.42.9/resize/resize2fs.c
===================================================================
@ -64,22 +64,22 @@ Index: e2fsprogs-1.42.9/resize/resize2fs.c @@ -64,22 +64,22 @@ Index: e2fsprogs-1.42.9/resize/resize2fs.c
+++ e2fsprogs-1.42.9/resize/resize2fs.c
@@ -1196,6 +1196,7 @@ static errcode_t resize2fs_get_alloc_blo
{
ext2_resize_t rfs = (ext2_resize_t) fs->priv_data;
blk64_t blk;
ext2_resize_t rfs = (ext2_resize_t) fs->priv_data;
blk64_t blk;
+ int group;

blk = get_new_block(rfs);
if (!blk)
blk = get_new_block(rfs);
if (!blk)
@@ -1208,6 +1209,12 @@ static errcode_t resize2fs_get_alloc_blo

ext2fs_mark_block_bitmap2(rfs->old_fs->block_map, blk);
ext2fs_mark_block_bitmap2(rfs->new_fs->block_map, blk);
ext2fs_mark_block_bitmap2(rfs->old_fs->block_map, blk);
ext2fs_mark_block_bitmap2(rfs->new_fs->block_map, blk);
+
+ group = ext2fs_group_of_blk2(rfs->old_fs, blk);
+ ext2fs_clear_block_uninit(rfs->old_fs, group);
+ group = ext2fs_group_of_blk2(rfs->new_fs, blk);
+ ext2fs_clear_block_uninit(rfs->new_fs, group);
+
*ret = (blk64_t) blk;
return 0;
*ret = (blk64_t) blk;
return 0;
}

28
SOURCES/e2fsprogs-1.42.9-resize2fs-fix-resizing-large-file-systems-when-block.patch

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
From c94aec3123293ed2288bd0bf5536d9bf16ecd07b Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 25 Oct 2016 13:18:14 -0400
Subject: [PATCH] resize2fs: fix resizing large file systems when block size !=
page size

Reported by: Jerry Lee <jerrylee@qnap.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
resize/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/resize/main.c b/resize/main.c
index 3951b09..cf86a23 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -406,7 +406,7 @@ int main (int argc, char ** argv)
new_size = max_size;
/* Round down to an even multiple of a pagesize */
if (sys_page_size > fs->blocksize)
- new_size &= ~((sys_page_size / fs->blocksize)-1);
+ new_size &= ~((blk64_t)((sys_page_size / fs->blocksize)-1));
}
if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
EXT4_FEATURE_INCOMPAT_64BIT)) {
--
2.21.0

52
SOURCES/e2fsprogs-1.42.9-resize2fs-fs-with-errors.patch

@ -3,26 +3,26 @@ Author: Eric Sandeen <sandeen@redhat.com> @@ -3,26 +3,26 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Mon Jun 9 09:52:19 2014 -0400

resize2fs: don't attempt to calculate minimum size on fs with errors

My old patch:

resize2fs: don't print minimum size if fs is not clean

resize2fs: don't print minimum size if fs is not clean
almost did this, but it still calculated the size; it just didn't print
it. Which is a bit silly.

Jes had a pretty badly corrupted image which made the minimum size
calculation go off into the weeds. It was corrupted, and also marked
as having an error.

We'll eventually bail out for an unmounted filesystem if it's marked
as being in an error state anyway; just move that test & bail-out
to a much earlier point, and remove the now-duplicate one under the
print_min_size block.

This will catch & block all resize operations on an offline filesystem
with errors, in one central place.

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
@ -32,9 +32,9 @@ index 2b7abff..e65c8e4 100644 @@ -32,9 +32,9 @@ index 2b7abff..e65c8e4 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -319,6 +319,17 @@ int main (int argc, char ** argv)
exit (1);
}

exit (1);
}
+ if (!(mount_flags & EXT2_MF_MOUNTED)) {
+ if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
+ (fs->super->s_state & EXT2_ERROR_FS) ||
@ -46,13 +46,13 @@ index 2b7abff..e65c8e4 100644 @@ -46,13 +46,13 @@ index 2b7abff..e65c8e4 100644
+ }
+ }
+
/*
* Check for compatibility with the feature sets. We need to
* be more stringent than ext2fs_open().
/*
* Check for compatibility with the feature sets. We need to
* be more stringent than ext2fs_open().
@@ -332,13 +343,6 @@ int main (int argc, char ** argv)
min_size = calculate_minimum_resize_size(fs, flags);

if (print_min_size) {
min_size = calculate_minimum_resize_size(fs, flags);
if (print_min_size) {
- if (!force && ((fs->super->s_state & EXT2_ERROR_FS) ||
- ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
- fprintf(stderr,
@ -60,13 +60,13 @@ index 2b7abff..e65c8e4 100644 @@ -60,13 +60,13 @@ index 2b7abff..e65c8e4 100644
- device_name);
- exit(1);
- }
printf(_("Estimated minimum size of the filesystem: %llu\n"),
min_size);
exit(0);
printf(_("Estimated minimum size of the filesystem: %llu\n"),
min_size);
exit(0);
@@ -444,14 +448,6 @@ int main (int argc, char ** argv)
bigalloc_check(fs, force);
retval = online_resize_fs(fs, mtpt, &new_size, flags);
} else {
bigalloc_check(fs, force);
retval = online_resize_fs(fs, mtpt, &new_size, flags);
} else {
- if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
- (fs->super->s_state & EXT2_ERROR_FS) ||
- ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
@ -75,6 +75,6 @@ index 2b7abff..e65c8e4 100644 @@ -75,6 +75,6 @@ index 2b7abff..e65c8e4 100644
- device_name);
- exit(1);
- }
bigalloc_check(fs, force);
printf(_("Resizing the filesystem on "
"%s to %llu (%dk) blocks.\n"),
bigalloc_check(fs, force);
printf(_("Resizing the filesystem on "
"%s to %llu (%dk) blocks.\n"),

37
SOURCES/e2fsprogs-1.42.9-set-pointer-to-NULL-after-ext2fs_free.patch

@ -21,43 +21,44 @@ index 4cdbde1..ef67493 100644 @@ -21,43 +21,44 @@ index 4cdbde1..ef67493 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -419,10 +419,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,

return 0;
return 0;
cleanup:
- if (flags & EXT2_FLAG_NOFREE_ON_ERROR)
- *ret_fs = fs;
- else
+ if (!(flags & EXT2_FLAG_NOFREE_ON_ERROR)) {
ext2fs_free(fs);
ext2fs_free(fs);
+ fs = NULL;
+ }
+ *ret_fs = fs;
return retval;
return retval;
}

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 6b32bbf..a1fdefa 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -202,6 +202,7 @@ errcode_t resize_fs(ext2_filsys fs, blk64_t *new_size, int flags,
rfs->flags = flags;

ext2fs_free(rfs->old_fs);
rfs->flags = flags;
ext2fs_free(rfs->old_fs);
+ rfs->old_fs = NULL;
if (rfs->itable_buf)
ext2fs_free_mem(&rfs->itable_buf);
if (rfs->reserve_blocks)
if (rfs->itable_buf)
ext2fs_free_mem(&rfs->itable_buf);
if (rfs->reserve_blocks)
@@ -213,8 +214,10 @@ errcode_t resize_fs(ext2_filsys fs, blk64_t *new_size, int flags,
return 0;

return 0;
errout:
- if (rfs->new_fs)
+ if (rfs->new_fs) {
ext2fs_free(rfs->new_fs);
ext2fs_free(rfs->new_fs);
+ rfs->new_fs = NULL;
+ }
if (rfs->itable_buf)
ext2fs_free_mem(&rfs->itable_buf);
ext2fs_free_mem(&rfs);
--
if (rfs->itable_buf)
ext2fs_free_mem(&rfs->itable_buf);
ext2fs_free_mem(&rfs);
--
1.8.3.1


43
SOURCES/e2fsprogs-1.43.3-libext2fs-don-t-ignore-fsync-errors.patch

@ -31,29 +31,29 @@ index a73c53f..000ebd8 100644 @@ -31,29 +31,29 @@ index a73c53f..000ebd8 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -410,16 +410,22 @@ write_primary_superblock_only:
ext2fs_swap_super(super_shadow);
ext2fs_swap_super(super_shadow);
#endif

- if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC))
+ if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC)) {
retval = io_channel_flush(fs->io);
retval = io_channel_flush(fs->io);
+ if (retval)
+ goto errout;
+ }
retval = write_primary_superblock(fs, super_shadow);
if (retval)
goto errout;

fs->flags &= ~EXT2_FLAG_DIRTY;

retval = write_primary_superblock(fs, super_shadow);
if (retval)
goto errout;
fs->flags &= ~EXT2_FLAG_DIRTY;
- if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC))
+ if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC)) {
retval = io_channel_flush(fs->io);
retval = io_channel_flush(fs->io);
+ if (retval)
+ goto errout;
+ }
errout:
fs->super->s_state = fs_state;
fs->super->s_state = fs_state;
#ifdef WORDS_BIGENDIAN
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 19be630..a2069f0 100644
@ -61,26 +61,27 @@ index 19be630..a2069f0 100644 @@ -61,26 +61,27 @@ index 19be630..a2069f0 100644
+++ b/lib/ext2fs/unix_io.c
@@ -885,7 +885,8 @@ static errcode_t unix_flush(io_channel channel)
#ifndef NO_IO_CACHE
retval = flush_cached_blocks(channel, data, 0);
retval = flush_cached_blocks(channel, data, 0);
#endif
- fsync(data->dev);
+ if (!retval && fsync(data->dev) != 0)
+ return errno;
return retval;
return retval;
}

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 3e3ef95..8952a5f 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2764,7 +2764,7 @@ no_journal:
retval = ext2fs_close(fs);
if (retval) {
fprintf(stderr, "%s",
retval = ext2fs_close(fs);
if (retval) {
fprintf(stderr, "%s",
- _("\nWarning, had trouble writing out superblocks."));
+ _("\nWarning, had trouble writing out superblocks.\n"));
} else if (!quiet) {
printf("%s", _("done\n\n"));
if (!getenv("MKE2FS_SKIP_CHECK_MSG"))
--
} else if (!quiet) {
printf("%s", _("done\n\n"));
if (!getenv("MKE2FS_SKIP_CHECK_MSG"))
--
2.7.4


5
SOURCES/e2fsprogs-1.43.4-tune2fs-edit-dire-warning-about-check-intervals.patch

@ -50,6 +50,7 @@ index e07da28..8949f64 100644 @@ -50,6 +50,7 @@ index e07da28..8949f64 100644
+(mount-count-dependent check) option for details.
.TP
.B \-j
Add an ext3 journal to the filesystem. If the
--
Add an ext3 journal to the filesystem. If the
--
2.7.5


15
SOURCES/e2fsprogs-1.43.6-libext2fs-skip-start_blk-adjustment-when-stride-and-.patch

@ -36,13 +36,14 @@ index 9f3d4e0..dd6015e 100644 @@ -36,13 +36,14 @@ index 9f3d4e0..dd6015e 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -108,7 +108,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
/*
* Allocate the block and inode bitmaps, if necessary
*/
/*
* Allocate the block and inode bitmaps, if necessary
*/
- if (fs->stride) {
+ if (fs->stride && !flexbg_size) {
retval = ext2fs_get_free_blocks2(fs, group_blk, last_blk,
1, bmap, &start_blk);
if (retval)
--
retval = ext2fs_get_free_blocks2(fs, group_blk, last_blk,
1, bmap, &start_blk);
if (retval)
--
2.7.5


17
SOURCES/e2fsprogs-1.44.1-e2fsck-warn-if-checkinterval-and-broken_system_clock.patch

@ -23,17 +23,18 @@ index 6f94644..d94d5dc 100644 @@ -23,17 +23,18 @@ 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;
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);
--
if (reason) {
log_out(ctx, "%s", ctx->device_name);
log_out(ctx, reason, reason_arg);
--
2.17.1


69
SOURCES/e2fsprogs-1.45.6-e2fsck-fix-file-systems-with-an-overly-large-s_first.patch

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
From 06b155bff995fe13d68cc2829121d0d719e6fde7 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 12:31:04 -0400
Subject: [PATCH 1/5] e2fsck: fix file systems with an overly large
s_first_meta_bg

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/problem.c | 5 +++++
e2fsck/problem.h | 3 +++
e2fsck/super.c | 12 ++++++++++++
3 files changed, 20 insertions(+)

diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 2e41bb2e..6c7f514e 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -438,6 +438,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 },
+
/* Meta_bg and resize_inode are not compatible, disable resize_inode*/
{ PR_0_DISABLE_RESIZE_INODE,
N_("Resize_@i and meta_bg features are enabled. Those features are\n"
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index a591974e..2fc9be05 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -252,6 +252,9 @@ struct problem_context {
/* 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
+
/* Meta_bg and resize_inode are not compatible, remove resize_inode*/
#define PR_0_DISABLE_RESIZE_INODE 0x000051
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 7e2c2e4f..7439d9d4 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -599,6 +599,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....
*/
--
2.21.3

60
SOURCES/e2fsprogs-1.45.6-resize2fs-disable-the-meta_bg-feature-if-necessary.patch

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
From 92bd5b69d7e7096fffc8cab08cc6886fe22df77d Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 12:33:11 -0400
Subject: [PATCH 2/5] resize2fs: disable the meta_bg feature if necessary

When shrinking a file system, if the number block groups drops below
the point where we started using the meta_bg layout, disable the
meta_bg feature and set s_first_meta_bg to zero. This is necessary to
avoid creating an invalid/corrupted file system after the shrink.

Addresses-Debian-Bug: #756922

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Marcin Wolcendorf <antymat+debian@chelmska.waw.pl>
Tested-by: Marcin Wolcendorf <antymat+debian@chelmska.waw.pl>
---
resize/resize2fs.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index a73390de..a2ff29ad 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -461,6 +461,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;
+ }
+
/*
* If we are shrinking the number of block groups, we're done
* and can exit now.
@@ -946,13 +953,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;
- }
if (old_blocks == new_blocks) {
retval = 0;
--
2.21.3

69
SOURCES/e2fsprogs-1.45.6-tests-add-f_first_meta_bg_too_big-test.patch

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
From 821c525c50d0fd704a3f189d8bdab2b97b65d887 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 13:03:43 -0400
Subject: [PATCH] tests: add f_first_meta_bg_too_big test

The test verifies that e2fsck can properly fix a file system where the
value of s_first_meta_bg in the superblock is larger than the number
of block group descriptors in the file system. E2fsck will fix this
by clearing the meta_bg feature.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/f_first_meta_bg_too_big/expect.1 | 20 ++++++++++++++++++++
tests/f_first_meta_bg_too_big/expect.2 | 7 +++++++
tests/f_first_meta_bg_too_big/name | 1 +
3 files changed, 28 insertions(+)
create mode 100644 tests/f_first_meta_bg_too_big/expect.1
create mode 100644 tests/f_first_meta_bg_too_big/expect.2
create mode 100644 tests/f_first_meta_bg_too_big/name

diff --git a/tests/f_first_meta_bg_too_big/expect.1 b/tests/f_first_meta_bg_too_big/expect.1
new file mode 100644
index 00000000..85786bda
--- /dev/null
+++ b/tests/f_first_meta_bg_too_big/expect.1
@@ -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
diff --git a/tests/f_first_meta_bg_too_big/expect.2 b/tests/f_first_meta_bg_too_big/expect.2
new file mode 100644
index 00000000..44bff624
--- /dev/null
+++ b/tests/f_first_meta_bg_too_big/expect.2
@@ -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
diff --git a/tests/f_first_meta_bg_too_big/name b/tests/f_first_meta_bg_too_big/name
new file mode 100644
index 00000000..47ec96db
--- /dev/null
+++ b/tests/f_first_meta_bg_too_big/name
@@ -0,0 +1 @@
+s_first_meta_bg is too large
--
2.21.3

59
SOURCES/e2fsprogs-1.45.6-tests-add-the-r_meta_bg_shrink-test.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
From c4e61a30629918fded02c728a2000d195db7ebe6 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 13:05:21 -0400
Subject: [PATCH 5/5] tests: add the r_meta_bg_shrink test

This test checks to make sure resize2fs can properly handle a file
system which started life as a normal ext4 file system and then was
grown to a size where meta_bg was enabled, and then shrunk back below
the point where the meta_bg format is still needed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/r_meta_bg_shrink/script | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 tests/r_meta_bg_shrink/script

diff --git a/tests/r_meta_bg_shrink/script b/tests/r_meta_bg_shrink/script
new file mode 100644
index 00000000..de777775
--- /dev/null
+++ b/tests/r_meta_bg_shrink/script
@@ -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
+
--
2.21.3

29
SOURCES/e2fsprogs-1.45.6-tests-make-sure-MKE2FS_FIRST_META_BG-is-unset-while-.patch

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
From 00b5f688f0d5df5913ea25e3481946c8191d826d Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 13:02:36 -0400
Subject: [PATCH 3/5] tests: make sure MKE2FS_FIRST_META_BG is unset while
running tests

If the developer has set the MKE2FS_FIRST_META_BG environment
variable, this can cause test failures.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/test_config | 1 +
1 file changed, 1 insertion(+)

diff --git a/tests/test_config b/tests/test_config
index 67896562..1872e5c8 100644
--- a/tests/test_config
+++ b/tests/test_config
@@ -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
--
2.21.3

1
SOURCES/ext2_types-wrapper.h

@ -26,3 +26,4 @@ @@ -26,3 +26,4 @@
#else
#error "This e2fsprogs-devel package does not work your architecture?"
#endif


BIN
SOURCES/image.gz

Binary file not shown.

109
SPECS/e2fsprogs.spec

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
Summary: Utilities for managing ext2, ext3, and ext4 filesystems
Name: e2fsprogs
Version: 1.42.9
Release: 13%{?dist}
Release: 19%{?dist}

# License tags based on COPYING file distinctions for various components
License: GPLv2
@ -9,6 +9,8 @@ Group: System Environment/Base @@ -9,6 +9,8 @@ Group: System Environment/Base
Source0: https://www.kernel.org/pub/linux/kernel/people/tytso/%{name}/v%{version}/%{name}-%{version}.tar.xz
Source1: ext2_types-wrapper.h
Source2: e2fsck.conf
# Test image for f_first_meta_bg_too_big test
Source3: image.gz

Patch1: e2fsprogs-1.40.4-sb_feature_check_ignore.patch
Patch2: e2fsprogs-1.42.9-set-pointer-to-NULL-after-ext2fs_free.patch
@ -40,6 +42,38 @@ Patch27: e2fsprogs-1.42.11-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl. @@ -40,6 +42,38 @@ Patch27: e2fsprogs-1.42.11-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.
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
Patch31: e2fsprogs-1.42.9-14-e2fsprogs-introduce-ext2fs_close_free-helper.patch
Patch32: e2fsprogs-1.42.9-14-libext2fs-fix-maximum-bg-overhead-calculation-with-m.patch
Patch33: e2fsprogs-1.42.9-14-libext2fs-automatically-enable-meta_bg-to-avoid-fill.patch
Patch34: e2fsprogs-1.42.9-14-libext2fs-don-t-create-filesystems-with-meta_bg-and-.patch
Patch35: e2fsprogs-1.42.9-14-libext2fs-fix-ext2fs_open2-error-for-meta_bg-image-f.patch
Patch36: e2fsprogs-1.42.9-14-e2fsck-remove-resize-inode-if-both-resize_inode-and-.patch
Patch37: e2fsprogs-1.42.9-14-resize2fs-Remove-the-real-kilobytes-rant-from-man-pa.patch
Patch38: e2fsprogs-1.42.9-14-filefrag-don-t-ignore-fsync-errors.patch
Patch39: e2fsprogs-1.42.9-14-mke2fs-Avoid-crashes-infinite-loops-for-absurdly-lar.patch
Patch40: e2fsprogs-1.42.9-14-e2fsck-fix-fd-leak-in-reserve_stdio_fds.patch
Patch41: e2fsprogs-1.42.9-14-e2fsck-fix-potential-Floating-Point-Exception-in-sho.patch
Patch42: e2fsprogs-1.42.9-14-misc-fix-Coverity-bugs.patch
Patch43: e2fsprogs-1.42.9-14-e2fsck-fix-free-pointer-dereferences.patch
Patch44: e2fsprogs-1.42.9-14-e2fsck-fix-off-by-one-bounds-check-on-group-number.patch
Patch45: e2fsprogs-1.42.9-14-e2fsck-fix-last-mount-time-and-last-write-time-in-pr.patch
Patch46: e2fsprogs-1.42.9-14-e2fsck-if-any-problems-are-fixed-in-pass-0-check-the.patch
Patch47: e2fsprogs-1.42.9-14-Clarify-how-the-description-of-the-dir_nlink-feature.patch
Patch48: e2fsprogs-1.42.9-14-e2fsck-set-dir_nlink-feature-if-large-dir-exists.patch
Patch49: e2fsprogs-1.42.11-e2fsck-free-ctx-fs-not-fs-at-the-end-of-fsck.patch
Patch50: e2fsprogs-1.42.9-resize2fs-fix-resizing-large-file-systems-when-block.patch
Patch51: e2fsprogs-1.42.9-e2fsck-abort-if-there-is-a-corrupted-directory-block.patch
Patch52: e2fsprogs-1.42.9-e2fsck-don-t-try-to-rehash-a-deleted-directory.patch
Patch53: e2fsprogs-1.42.9-libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch
Patch54: e2fsprogs-1.42.9-e2image-fix-metadata-image-handling-on-big-endian-sy.patch
Patch55: e2fsprogs-1.42.9-Fix-typo-in-the-ext4-5-man-page.patch
Patch56: e2fsprogs-1.42.9-mke2fs.conf-Introduce-rhel6-fs_type.patch
Patch57: e2fsprogs-1.42.9-e2fsck-clarify-overflow-link-count-error-message.patch
Patch58: e2fsprogs-1.45.6-e2fsck-fix-file-systems-with-an-overly-large-s_first.patch
Patch59: e2fsprogs-1.45.6-resize2fs-disable-the-meta_bg-feature-if-necessary.patch
Patch60: e2fsprogs-1.45.6-tests-make-sure-MKE2FS_FIRST_META_BG-is-unset-while-.patch
Patch61: e2fsprogs-1.45.6-tests-add-f_first_meta_bg_too_big-test.patch
Patch62: e2fsprogs-1.45.6-tests-add-the-r_meta_bg_shrink-test.patch

Url: http://e2fsprogs.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -219,11 +253,44 @@ It was originally inspired by the Multics SubSystem library. @@ -219,11 +253,44 @@ It was originally inspired by the Multics SubSystem library.
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1

%build
%configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \
--disable-e2initrd-helper --disable-libblkid --disable-libuuid \
--with-root-prefix=/usr

# Disable some instructions on ppc build of libext2fs; see bug #1074604
# and e2fsprogs-1.42.9-no-ppc-altivec.patch
%ifarch ppc
@ -265,6 +332,8 @@ rm -rf tests/r_ext4_small_bg @@ -265,6 +332,8 @@ rm -rf tests/r_ext4_small_bg
# but either this test or the build environment. Anyway it's
# blocking release of a hotfix so let's remove it for now.
rm -rf tests/f_mmp
# Copy the image.gz for the f_first_meta_bg_too_big test to it's place
cp --force %{SOURCE3} tests/f_first_meta_bg_too_big/image.gz
make check

%clean
@ -411,6 +480,31 @@ exit 0 @@ -411,6 +480,31 @@ exit 0
%{_libdir}/pkgconfig/ss.pc

%changelog
* Tue Jul 07 2020 Lukas Czerner <lczerner@redhat.com> 1.45.6-19
- fix issues with meta_bg when resizing file system (#1849718)

* Wed May 06 2020 Lukas Czerner <lczerner@redhat.com> 1.42.9-18
- fix out-of-bounds write on corrupted fs (#1797731)
- fix out-of-bounds write on corrupted fs (#1768710)
- fix e2fsprogs creating corrupted meta image (#1711880)
- fix typo in ext4 man page (#1720130)
- provide easy metod for creating compatible rhel6 fs (#1780277)
- better handling of trivial dir link count problem (#1820048)

* Mon Nov 18 2019 Lukas Czerner <lczerner@redhat.com> 1.42.9-17
- fix resizing large file systems when block size != page size (#1771515)

* Mon Jun 17 2019 Lukas Czerner <lczerner@redhat.com> 1.42.9-16
- Fix NULL pointer dereference when releasing memory (#1720903)

* Wed Feb 27 2019 Lukas Czerner <lczerner@redhat.com> 1.42.9-15
- set dir_nlink feature if large dir exists (#1683694)

* Mon Feb 25 2019 Lukas Czerner <lczerner@redhat.com> 1.42.9-14
- Various fixes and improvements (#1682935)
- Automatically enable meta_bg to avoid failure when creating huge fs with small bs (#1608635)
- don't ignore fsync errors in filefrag (#1451185)

* Tue Jun 13 2018 Lukas Czerner <lczerner@redhat.com> 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)
@ -554,7 +648,7 @@ exit 0 @@ -554,7 +648,7 @@ exit 0
- Fix use of uninitialized memory via ext2fs_copy_generic_bmap()

* Tue Aug 09 2011 Eric Sandeen <sandeen@redhat.com> 1.42-0.1.WIP.0702
- Test release for >16T support
- Test release for >16T support

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.41.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
@ -676,9 +770,9 @@ exit 0 @@ -676,9 +770,9 @@ exit 0
- set BuildRequires: libblkid-devel (from util-linux-ng)

* Mon Jun 8 2009 Karel Zak <kzak@redhat.com> 1.41.6-3
- temporary use BuildRequires: e2fsprogs-devel (we cannot install
new util-linux-ng with libblkid to buildroots without new e2fsprogs
without libblkid).
- temporary use BuildRequires: e2fsprogs-devel (we cannot install
new util-linux-ng with libblkid to buildroots without new e2fsprogs
without libblkid).

* Thu Jun 4 2009 Karel Zak <kzak@redhat.com> 1.41.6-2
- disable libblkid (replaced by libblkid from util-linux-ng)
@ -854,7 +948,7 @@ exit 0 @@ -854,7 +948,7 @@ exit 0
- Add arm to multilib header wrapper

* Sat Oct 20 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-10
- Make (more) file timestamps match those in tarball for multilib tidiness
- Make (more) file timestamps match those in tarball for multilib tidiness
- Fix e2fsprogs-libs summary (shared libs not static)

* Tue Oct 15 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-9
@ -867,7 +961,7 @@ exit 0 @@ -867,7 +961,7 @@ exit 0
- Fix blkid fat probe when there is a real MBR (#290951)

* Tue Sep 18 2007 Oliver Falk <oliver@linux-kernel.at> 1.40.2-6
- Add alpha to the header wrappers
- Add alpha to the header wrappers

* Fri Sep 07 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-5
- wrap a couple headers to fix multilib issues (#270441)
@ -1014,3 +1108,4 @@ exit 0 @@ -1014,3 +1108,4 @@ exit 0
Merged from RHEL-4
- enable tune2fs to set and clear feature resize_inode (#167816)
- removed outdated information from ext2online man page (#164383)


Loading…
Cancel
Save