diff --git a/0005-resize2fs-resize2fs-disk-hardlinks-will-be-error.patch b/0005-resize2fs-resize2fs-disk-hardlinks-will-be-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c34694b2d0d600e5cce0da0796ae7a378298dba --- /dev/null +++ b/0005-resize2fs-resize2fs-disk-hardlinks-will-be-error.patch @@ -0,0 +1,59 @@ +From 228e9f0567eebd4597bd1771fc4bf3650190cf3e Mon Sep 17 00:00:00 2001 +From: zhanchengbin +Date: Thu, 24 Feb 2022 10:06:30 +0800 +Subject: [PATCH] resize2fs: resize2fs disk hardlinks will be error + +Resize2fs disk hardlinks which mounting after the same name as tmpfs + filesystem it will be error. The items in /proc/mounts are traversed, +when you get to tmpfs, file!=mnt->mnt_fsname, therefore, the +stat(mnt->mnt_fsname, &st_buf) branch is used, however, the values of + file_rdev and st_buf.st_rdev are the same, As a result, the system +mistakenly considers that disk is mounted to /root/tmp. As a result +, resize2fs fails. + +example: +dev_name="/dev/sdc" (ps: a disk in you self) +mkdir /root/tmp +mkdir /root/mnt +mkfs.ext4 -F -b 1024 -E "resize=10000000" "${dev_name}" 32768 +mount -t tmpfs "${dev_name}" /root/tmp +mount "${dev_name}" /root/tmp +ln "${dev_name}" "${dev_name}"-ln +resize2fs "${dev_name}"-ln 6G + +Signed-off-by: zhanchengbin +Signed-off-by: guiyao +--- + lib/ext2fs/ismounted.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c +index aee7d72..463a82a 100644 +--- a/lib/ext2fs/ismounted.c ++++ b/lib/ext2fs/ismounted.c +@@ -98,6 +98,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, + { + struct mntent *mnt; + struct stat st_buf; ++ struct stat dir_st_buf; + errcode_t retval = 0; + dev_t file_dev=0, file_rdev=0; + ino_t file_ino=0; +@@ -144,8 +145,12 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, + if (stat(mnt->mnt_fsname, &st_buf) == 0) { + if (ext2fsP_is_disk_device(st_buf.st_mode)) { + #ifndef __GNU__ +- if (file_rdev && (file_rdev == st_buf.st_rdev)) +- break; ++ if (file_rdev && (file_rdev == st_buf.st_rdev)) { ++ if (stat(mnt->mnt_dir, &dir_st_buf) != 0) ++ continue; ++ if (file_rdev == dir_st_buf.st_dev) ++ break; ++ } + if (check_loop_mounted(mnt->mnt_fsname, + st_buf.st_rdev, file_dev, + file_ino) == 1) +-- +1.8.3.1 + diff --git a/0006-e2fsck-exit-journal-recovery-when-find-EIO-ENOMEM-er.patch b/0006-e2fsck-exit-journal-recovery-when-find-EIO-ENOMEM-er.patch new file mode 100644 index 0000000000000000000000000000000000000000..86a91841a17906e4515f528769f8799af64d4a13 --- /dev/null +++ b/0006-e2fsck-exit-journal-recovery-when-find-EIO-ENOMEM-er.patch @@ -0,0 +1,51 @@ +From dc4c71c6192f9709a2d833f9aa63d3463da6155a Mon Sep 17 00:00:00 2001 +From: lihaotian +Date: Tue, 15 Dec 2020 11:46:07 +0000 +Subject: [PATCH] e2fsck: exit journal recovery when find EIO, ENOMEM + errors + +jbd2_journal_revocer() may fail when some error occers +such as ENOMEM. However, jsb->s_start is still cleared +by func e2fsck_journal_release(). This may break +consistency between metadata and data in disk. Sometimes, +failure in jbd2_journal_revocer() is temporary but retry +e2fsck will skip the journal recovery when the temporary +problem is fixed. + +To fix this case, we use "fatal_error" instead "goto errout" +when recover journal failed. If journal recovery fails, we +will send error message to user and reserve the recovery +flags to recover the journal when try e2fsck again. + +Fix issue: https://gitee.com/src-openeuler/e2fsprogs/issues/I4RZUT?from=project-issue + +conflict: journal_recover -> jbd2_journal_recover + +Reported-by: Liangyun +Signed-off-by: Haotian Li +Signed-off-by: Zhiqiang Liu +--- + e2fsck/journal.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/e2fsck/journal.c b/e2fsck/journal.c +index e83f3a9..a5f7088 100644 +--- a/e2fsck/journal.c ++++ b/e2fsck/journal.c +@@ -942,6 +942,13 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx) + goto errout; + + retval = -jbd2_journal_recover(journal); ++ if (retval == EIO || retval == ENOMEM || retval == EXT2_ET_NO_MEMORY) { ++ ctx->fs->flags &= ~EXT2_FLAG_VALID; ++ com_err(ctx->program_name, 0, ++ _("Journal recovery failed " ++ "on %s, retval=%d \n"), ctx->device_name, retval); ++ fatal_error(ctx, 0); ++ } + if (retval) + goto errout; + +-- +2.21.1 (Apple Git-122.3) + diff --git a/0007-e2fsck-exit-journal-recovery-when-jounral-superblock.patch b/0007-e2fsck-exit-journal-recovery-when-jounral-superblock.patch new file mode 100644 index 0000000000000000000000000000000000000000..5008d13c2c57006ff10ce5f7ffcd76e8a1a03ebe --- /dev/null +++ b/0007-e2fsck-exit-journal-recovery-when-jounral-superblock.patch @@ -0,0 +1,98 @@ +From f923f6ddbd555801f1d6495904de4fefb363fa57 Mon Sep 17 00:00:00 2001 +From: liangyun2 +Date: Sat, 19 Dec 2020 12:05:37 +0800 +Subject: [PATCH] e2fsck: exit journal recovery when jounral superblock fails + to update + +Jounral superblock may be failed to update in e2fsck_journal_release. +But if needs_recovery flag is cleared, e2fsck_check_ext3_journal will be failed. + +To fix this case, we use "fatal_error" when recover journal failed. +So we can reserve the recovery flag to recover the journal when try e2fsck again. + +Fix issue: https://gitee.com/src-openeuler/e2fsprogs/issues/I4S0SD?from=project-issue + +conflict: journal_destroy_revoke -> jbd2_journal_destroy_revoke + journal_destroy_revoke_caches -> jbd2_journal_destroy_revoke_record_cache + jbd2_journal_destroy_revoke_table_cache + JFS_BARRIER -> JBD2_BARRIER + blkdev_issue_flush(kdev, a, b) -> blkdev_issue_flush(kdev) + +Reported-by: Liangyun +Signed-off-by: Haotian Li +Signed-off-by: Zhiqiang Liu +--- + e2fsck/journal.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +diff --git a/e2fsck/journal.c b/e2fsck/journal.c +index 7081b6e..f4253c0 100644 +--- a/e2fsck/journal.c ++++ b/e2fsck/journal.c +@@ -1444,10 +1444,12 @@ static errcode_t e2fsck_journal_fix_corrupt_super(e2fsck_t ctx, + return 0; + } + +-static void e2fsck_journal_release(e2fsck_t ctx, journal_t *journal, ++static errcode_t e2fsck_journal_release(e2fsck_t ctx, journal_t *journal, + int reset, int drop) + { + journal_superblock_t *jsb; ++ errcode_t err = 0; ++ errcode_t err2; + + if (drop) + mark_buffer_clean(journal->j_sb_buffer); +@@ -1461,6 +1463,16 @@ static void e2fsck_journal_release(e2fsck_t ctx, journal_t *journal, + } + brelse(journal->j_sb_buffer); + ++ if(reset == 1 && drop == 0) { ++ err = sync_blockdev(journal->j_fs_dev); ++ /* Make sure all replayed data is on permanent storage */ ++ if (journal->j_flags & JBD2_BARRIER) { ++ err2 = blkdev_issue_flush(journal->j_fs_dev); ++ if (!err) ++ err = err2; ++ } ++ } ++ + if (ctx->journal_io) { + if (ctx->fs && ctx->fs->io != ctx->journal_io) + io_channel_close(ctx->journal_io); +@@ -1474,6 +1486,8 @@ static void e2fsck_journal_release(e2fsck_t ctx, journal_t *journal, + if (journal->j_fs_dev) + ext2fs_free_mem(&journal->j_fs_dev); + ext2fs_free_mem(&journal); ++ ++ return err; + } + + /* +@@ -1612,6 +1626,7 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx) + struct problem_context pctx; + journal_t *journal; + errcode_t retval; ++ errcode_t recover_retval; + + clear_problem_context(&pctx); + +@@ -1659,7 +1674,14 @@ errout: + jbd2_journal_destroy_revoke(journal); + jbd2_journal_destroy_revoke_record_cache(); + jbd2_journal_destroy_revoke_table_cache(); +- e2fsck_journal_release(ctx, journal, 1, 0); ++ recover_retval = e2fsck_journal_release(ctx, journal, 1, 0); ++ if(recover_retval == -EIO) { ++ ctx->fs->flags &= ~EXT2_FLAG_VALID; ++ com_err(ctx->program_name, 0, ++ _("e2fsck journal release failed " ++ "on %s, retval=%d \n"), ctx->device_name, recover_retval); ++ fatal_error(ctx, 0); ++ } + return retval; + } + +-- +1.8.3.1 + diff --git a/0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch b/0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch new file mode 100644 index 0000000000000000000000000000000000000000..e64c7fb4ee1e266f65e6aa39baf0f889959be914 --- /dev/null +++ b/0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch @@ -0,0 +1,41 @@ +From 491c2dea43a9c9f33c5feb9ccd9b91d04a24b6f7 Mon Sep 17 00:00:00 2001 +From: Haotian +Date: Wed, 17 Mar 2021 17:34:14 +0800 +Subject: [PATCH] e2fsck: add env param E2FS_UNRELIABLE_IO to fix + unreliable io case + +Func write_primary_superblock() has two way to wirte disk. One is 1k block, +the other is byte by byte as default. On unreliable IO case such as flaky +network, the byte-by-byte method may lost some data of ext4-superblock. +Then, the superblock may lose consistency and the sb checksum error will +occur. + +We provide the env param E2FS_UNRELIABLE_IO for users to choose if it's +necessary to take 1k block way on writing disk. + +Fix issue:https://gitee.com/src-openeuler/e2fsprogs/issues/I4RZVX?from=project-issue + +Signed-off-by: Haotian Li +Signed-off-by: Zhiqiang Liu +--- + lib/ext2fs/closefs.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c +index 1d4d5b7..1893fb6 100644 +--- a/lib/ext2fs/closefs.c ++++ b/lib/ext2fs/closefs.c +@@ -195,8 +195,9 @@ static errcode_t write_primary_superblock(ext2_filsys fs, + __u16 *old_super, *new_super; + int check_idx, write_idx, size; + errcode_t retval; ++ int is_unreliable_io = getenv("E2FS_UNRELIABLE_IO") ? 1 : 0; + +- if (!fs->io->manager->write_byte || !fs->orig_super) { ++ if (!fs->io->manager->write_byte || !fs->orig_super || is_unreliable_io) { + fallback: + io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET); + retval = io_channel_write_blk64(fs->io, 1, -SUPERBLOCK_SIZE, +-- +2.21.1 (Apple Git-122.3) + diff --git a/0009-tests-update-expect-files-for-f_large_dir-and-f_larg.patch b/0009-tests-update-expect-files-for-f_large_dir-and-f_larg.patch new file mode 100644 index 0000000000000000000000000000000000000000..56610bab358a9d8e9449e17d7bbc6d0991c9c678 --- /dev/null +++ b/0009-tests-update-expect-files-for-f_large_dir-and-f_larg.patch @@ -0,0 +1,38 @@ +From da33289073de254ab4bacb80b1b83cf9d27c76ea Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Tue, 24 Aug 2021 14:10:20 +0200 +Subject: [PATCH] tests: update expect files for f_large_dir and + f_large_dir_csum + +Update expect files for f_large_dir and f_large_dir_csum tests to +include the warning about missing y2038 support with 128-byte inodes. + +Fixes: a23b50cd ("mke2fs: warn about missing y2038 support when formatting fresh ext4 fs") +Signed-off-by: Lukas Czerner +Signed-off-by: Theodore Ts'o +--- + tests/f_large_dir/expect | 1 + + tests/f_large_dir_csum/expect | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/tests/f_large_dir/expect b/tests/f_large_dir/expect +index 028234c..495ea85 100644 +--- a/tests/f_large_dir/expect ++++ b/tests/f_large_dir/expect +@@ -1,3 +1,4 @@ ++128-byte inodes cannot handle dates beyond 2038 and are deprecated + Creating filesystem with 108341 1k blocks and 65072 inodes + Superblock backups stored on blocks: + 8193, 24577, 40961, 57345, 73729 +diff --git a/tests/f_large_dir_csum/expect b/tests/f_large_dir_csum/expect +index aa9f33f..44770f7 100644 +--- a/tests/f_large_dir_csum/expect ++++ b/tests/f_large_dir_csum/expect +@@ -1,3 +1,4 @@ ++128-byte inodes cannot handle dates beyond 2038 and are deprecated + Creating filesystem with 31002 1k blocks and 64 inodes + Superblock backups stored on blocks: + 8193, 24577 +-- +1.8.3.1 + diff --git a/e2fsprogs.spec b/e2fsprogs.spec index bfac585f83cf8fd40c6fe651d01d2790e1451453..92ce177c34647cb97a98b625dfada5250885b1a0 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -1,6 +1,6 @@ Name: e2fsprogs Version: 1.46.4 -Release: 2 +Release: 4 Summary: Second extended file system management tools License: GPLv2+ and LGPLv2 and MIT URL: http://e2fsprogs.sourceforge.net/ @@ -10,6 +10,12 @@ Patch1: 0001-e2fsprogs-set-hugefile-from-4T-to-1T-in-hugefile-tes.patch Patch2: 0002-libss-add-newer-libreadline.so.8-to-dlopen-path.patch Patch3: 0003-tests-update-expect-files-for-f_mmp_garbage.patch Patch4: 0004-tests-update-expect-files-for-f_large_dir-and-f_larg.patch +Patch5: 0005-resize2fs-resize2fs-disk-hardlinks-will-be-error.patch +Patch6: 0006-e2fsck-exit-journal-recovery-when-find-EIO-ENOMEM-er.patch +Patch7: 0007-e2fsck-exit-journal-recovery-when-jounral-superblock.patch +Patch8: 0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch +Patch9: 0009-tests-update-expect-files-for-f_large_dir-and-f_larg.patch + BuildRequires: gcc pkgconfig texinfo BuildRequires: fuse-devel libblkid-devel libuuid-devel @@ -131,6 +137,240 @@ exit 0 %{_mandir}/man8/* %changelog +* Thu Mon 28 2022 zhanchengbin - 1.46.4-4 +- backport upstream patch to fix tests + +* Thu Feb 24 2022 zhanchengbin - 1.46.4-3 +- adapt patchs from openEuler-20.03-LTS + +* Thu Jan 27 2022 zhanchengbin - 1.46.4-2 +- replace License in spec + +* Sat Nov 27 2021 zhanchengbin - 1.46.4-1 +- update package to v1.46.4. + +* Mon Nov 15 2021 zhanchengbin - 1.45.6-7 +- DESC: integrate community patches. + +* Sun Sep 13 2021 lixiaokeng - 1.45.6-6 +- DESC: add newer libreadline.so.8 to dlopen path + +* Fri Aug 20 2021 chenyanpanHW - 1.45.6-5 +- DESC: add necessary BuildRequires audit + +* Fri Jul 30 2021 chenyanpanHW - 1.45.6-4 +- DESC: delete -Sgit from %autosetup, and delete BuildRequires git + +* Wed Dec 16 2020 yanglongkang - 1.45.6-3 +- Set help package as install require + +* Fri Oct 30 2020 Zhiqiang Liu - 1.45.6-2 +- backport upstream patches-epoch2 to fix some problems + +* Wed Jul 15 2020 Zhiqiang Liu - 1.45.6-1 +- rebuild package + +* Wed Jul 1 2020 Wu Bo - 1.45.3-5 +- rebuild package + +* Mon Feb 3 2020 luoshijie - 1.45.3-4 +- Type:cves +- ID:CVE-2019-5094 +- SUG:restart +- DESC:backport patch to fix CVE-2019-5094. + +* Wed Jan 22 2020 openEuler Buildteam - 1.45.3-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:change path to remove no used file. + +* Wed Jan 22 2020 openEuler Buildteam - 1.45.3-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix local rpmbuild error. + +* Mon Jan 14 2020 openEuler Buildteam - 1.45.3-1 +- Type:cves +- ID:CVE-2019-5188 +- SUG:restart +- DESC:backport patch to fix CVE-2019-5188. + +* Mon Jan 14 2020 openEuler Buildteam - 1.45.3-0 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update package from 1.44.3 to 1.45.3. + +* Mon Jan 13 2020 openEuler Buildteam - 1.44.3-8 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update spec. + +* Wed Sep 18 2019 luoshijie - 1.44.3-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:modify spec file to follow spec rules. + +* Fri Sep 6 2019 luoshijie - 1.44.3-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:openEuler Debranding + +* Tue Aug 20 2019 luoshijie - 1.44.3-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:rename patch name + +* Wed Jul 10 2019 zhangyujing - 1.44.3-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:e2freefrag: fix memory leak in scan_online() + create_inode: fix potential memory leak in path_append() + mke2fs: fix check for absurdly large devices + +* Fri Mar 15 2019 zhangyujing - 1.44.3-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:blkid avoid FPE crash when probing a HFS superblock + AOSP e2fsdroid Fix crash with invalid command line a + e2fsck fix fd leak in reserve_stdio_fds + libext2fs fix uninitialized length in rep_strdup + tune2fs fix dereference of freed memory after journa + libe2p avoid segfault when s_nr_users is too high + e2freefrag fix free blocks count during live scan + +* Wed Jan 23 2019 wangxiao - 1.44.3-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:disable the metadata_csum creat by mke2fs -t ext4 by default +- Package init + +* Thu Feb 24 2022 zhanchengbin - 1.46.4-3 +- adapt patchs from openEuler-20.03-LTS + +* Thu Jan 27 2022 zhanchengbin - 1.46.4-2 +- replace License in spec + +* Sat Nov 27 2021 zhanchengbin - 1.46.4-1 +- update package to v1.46.4. + +* Mon Nov 15 2021 zhanchengbin - 1.45.6-7 +- DESC: integrate community patches. + +* Sun Sep 13 2021 lixiaokeng - 1.45.6-6 +- DESC: add newer libreadline.so.8 to dlopen path + +* Fri Aug 20 2021 chenyanpanHW - 1.45.6-5 +- DESC: add necessary BuildRequires audit + +* Fri Jul 30 2021 chenyanpanHW - 1.45.6-4 +- DESC: delete -Sgit from %autosetup, and delete BuildRequires git + +* Wed Dec 16 2020 yanglongkang - 1.45.6-3 +- Set help package as install require + +* Fri Oct 30 2020 Zhiqiang Liu - 1.45.6-2 +- backport upstream patches-epoch2 to fix some problems + +* Wed Jul 15 2020 Zhiqiang Liu - 1.45.6-1 +- rebuild package + +* Wed Jul 1 2020 Wu Bo - 1.45.3-5 +- rebuild package + +* Mon Feb 3 2020 luoshijie - 1.45.3-4 +- Type:cves +- ID:CVE-2019-5094 +- SUG:restart +- DESC:backport patch to fix CVE-2019-5094. + +* Wed Jan 22 2020 openEuler Buildteam - 1.45.3-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:change path to remove no used file. + +* Wed Jan 22 2020 openEuler Buildteam - 1.45.3-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix local rpmbuild error. + +* Mon Jan 14 2020 openEuler Buildteam - 1.45.3-1 +- Type:cves +- ID:CVE-2019-5188 +- SUG:restart +- DESC:backport patch to fix CVE-2019-5188. + +* Mon Jan 14 2020 openEuler Buildteam - 1.45.3-0 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update package from 1.44.3 to 1.45.3. + +* Mon Jan 13 2020 openEuler Buildteam - 1.44.3-8 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update spec. + +* Wed Sep 18 2019 luoshijie - 1.44.3-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:modify spec file to follow spec rules. + +* Fri Sep 6 2019 luoshijie - 1.44.3-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:openEuler Debranding + +* Tue Aug 20 2019 luoshijie - 1.44.3-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:rename patch name + +* Wed Jul 10 2019 zhangyujing - 1.44.3-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:e2freefrag: fix memory leak in scan_online() + create_inode: fix potential memory leak in path_append() + mke2fs: fix check for absurdly large devices + +* Fri Mar 15 2019 zhangyujing - 1.44.3-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:blkid avoid FPE crash when probing a HFS superblock + AOSP e2fsdroid Fix crash with invalid command line a + e2fsck fix fd leak in reserve_stdio_fds + libext2fs fix uninitialized length in rep_strdup + tune2fs fix dereference of freed memory after journa + libe2p avoid segfault when s_nr_users is too high + e2freefrag fix free blocks count during live scan + +* Wed Jan 23 2019 wangxiao - 1.44.3-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:disable the metadata_csum creat by mke2fs -t ext4 by default +- Package init + +* Thu Feb 24 2022 zhanchengbin - 1.46.4-3 +- adapt patchs from openEuler-20.03-LTS + * Thu Jan 27 2022 zhanchengbin - 1.46.4-2 - replace License in spec