e2fsprogs升级

Signed-off-by: psycho <wangmingxuan6@h-partners.com>
This commit is contained in:
psycho
2024-01-03 11:33:19 +08:00
parent 79a9925d80
commit c9c9fb5e62
19 changed files with 1130 additions and 51 deletions
+136
View File
@@ -0,0 +1,136 @@
From 13f1ce96046fba15d93a90733b791312284fbb62 Mon Sep 17 00:00:00 2001
From: Andreas Dilger <adilger@whamcloud.com>
Date: Mon, 28 Feb 2022 21:17:06 -0700
Subject: [PATCH] tests: fix ACL-printing tests
Fix the ACL-printing tests to be more flexible for different systems.
If the MKFS_DIR is on tmpfs, it will not list "system.posix_acl*"
xattrs, so they will not be copied. Create this on a real filesystem
or skip the test if that doesn't work.
Filter out the security.selinux xattr if it is printed, since this
depends on the selinux configuration of the host system. However,
this also spills xattrs for "acl_dir/file" into an external xattr
block, and causes it to fail due to different block allocations.
Increase the filesystem inode size so that the allocation is the same
regardless of whether selinux is enabled or not.
Fixes: 67e6ae0a35 ("mke2fs: fix a importing a directory with an ACL")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/filter.sed | 1 +
tests/m_rootdir_acl/expect | 18 +++++++++---------
tests/m_rootdir_acl/script | 13 +++++++++----
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/tests/filter.sed b/tests/filter.sed
index 796186e..5fd68f3 100644
--- a/tests/filter.sed
+++ b/tests/filter.sed
@@ -20,6 +20,7 @@ s/\\015//g
/^Maximum mount count:/d
/^Next check after:/d
/^Suggestion:/d
+/security.selinux/d
/Reserved blocks uid:/s/ (user .*)//
/Reserved blocks gid:/s/ (group .*)//
/whichever comes first/d
diff --git a/tests/m_rootdir_acl/expect b/tests/m_rootdir_acl/expect
index babd802..57f03e5 100644
--- a/tests/m_rootdir_acl/expect
+++ b/tests/m_rootdir_acl/expect
@@ -10,8 +10,8 @@ Filesystem OS type: Linux
Inode count: 1024
Block count: 16384
Reserved block count: 819
-Overhead clusters: 1543
-Free blocks: 14788
+Overhead clusters: 1799
+Free blocks: 14533
Free inodes: 1003
First block: 1
Block size: 1024
@@ -21,14 +21,14 @@ Reserved GDT blocks: 127
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 512
-Inode blocks per group: 128
+Inode blocks per group: 256
Flex block group size: 16
Mount count: 0
Check interval: 15552000 (6 months)
Reserved blocks uid: 0
Reserved blocks gid: 0
First inode: 11
-Inode size: 256
+Inode size: 512
Required extra isize: 32
Desired extra isize: 32
Journal inode: 8
@@ -49,16 +49,16 @@ Group 0: (Blocks 1-8192)
Reserved GDT blocks at 3-129
Block bitmap at 130 (+129)
Inode bitmap at 132 (+131)
- Inode table at 134-261 (+133)
- 7750 free blocks, 491 free inodes, 5 directories, 491 unused inodes
- Free blocks: 443-8192
+ Inode table at 134-389 (+133)
+ 7495 free blocks, 491 free inodes, 5 directories, 491 unused inodes
+ Free blocks: 698-8192
Free inodes: 22-512
Group 1: (Blocks 8193-16383) [INODE_UNINIT]
Backup superblock at 8193, Group descriptors at 8194-8194
Reserved GDT blocks at 8195-8321
Block bitmap at 131 (bg #0 + 130)
Inode bitmap at 133 (bg #0 + 132)
- Inode table at 262-389 (bg #0 + 261)
+ Inode table at 390-645 (bg #0 + 389)
7038 free blocks, 512 free inodes, 0 directories, 512 unused inodes
Free blocks: 9346-16383
Free inodes: 513-1024
@@ -116,4 +116,4 @@ Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
-test.img: 21/1024 files (0.0% non-contiguous), 1596/16384 blocks
+test.img: 21/1024 files (0.0% non-contiguous), 1851/16384 blocks
diff --git a/tests/m_rootdir_acl/script b/tests/m_rootdir_acl/script
index e81c82c..a00e4c4 100644
--- a/tests/m_rootdir_acl/script
+++ b/tests/m_rootdir_acl/script
@@ -16,12 +16,10 @@ if [ "$os" = "GNU" ]; then
return 0
fi
-MKFS_DIR=$TMPFILE.dir
+MKFS_DIR=$(mktemp -d ./$test_name-XXXXXX.tmp)
OUT=$test_name.log
EXP=$test_dir/expect
-rm -rf $MKFS_DIR
-mkdir -p $MKFS_DIR
touch $MKFS_DIR/emptyfile
dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile
echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null
@@ -60,7 +58,14 @@ mask::r-x
other::r-x
EOF
-$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
+if ! getfattr -d -m - $MKFS_DIR/acl_dir | grep -q posix_acl; then
+ echo "$test_name: $test_description: skipped (no posix_acl xattrs)"
+ rm -rf $MKFS_DIR
+ return 0
+fi
+
+# use 512-byte inodes so with/out security.selinux xattr doesn't fail
+$MKE2FS -q -F -o Linux -T ext4 -I 512 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
$DUMPE2FS $TMPFILE >> $OUT 2>&1
cat > $TMPFILE.cmd << ENDL
--
1.8.3.1
@@ -1,30 +0,0 @@
From e71489b24a49899ca016068cbe39ad0576c52eb5 Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Thu, 17 Mar 2022 10:53:18 +0800
Subject: [PATCH] tests: skip m_rootdir_acl if selinux is not disabled
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
---
tests/m_rootdir_acl/script | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/m_rootdir_acl/script b/tests/m_rootdir_acl/script
index e81c82c..6b78d3d 100644
--- a/tests/m_rootdir_acl/script
+++ b/tests/m_rootdir_acl/script
@@ -16,6 +16,12 @@ if [ "$os" = "GNU" ]; then
return 0
fi
+selinux=`grep -nRE "^SELINUX=" /etc/selinux/config | awk -F "=" '{print $2}'`
+if [ $selinux != "disabled" ]; then
+ echo "$test_name: $test_description: skipped (selinux is not disabled)"
+ return 0
+fi
+
MKFS_DIR=$TMPFILE.dir
OUT=$test_name.log
EXP=$test_dir/expect
--
1.8.3.1
@@ -0,0 +1,61 @@
From 3dcbf460613413614684013a51279f1e65c32f9e Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Wed, 18 May 2022 15:16:25 +0800
Subject: [PATCH] e2fsck: do not clean up file acl if the inode is truncating
type
We got issue as follows:
[root@localhost ~]# e2fsck -a img
img: recovering journal
img: Truncating orphaned inode 188 (uid=0, gid=0, mode=0100666, size=0)
img: Truncating orphaned inode 174 (uid=0, gid=0, mode=0100666, size=0)
img: clean, 484/128016 files, 118274/512000 blocks
[root@localhost ~]# e2fsck -fn img
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Inode 174, i_blocks is 2, should be 0. Fix? no
Inode 188, i_blocks is 2, should be 0. Fix? no
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
img: ********** WARNING: Filesystem still has errors **********
img: 484/128016 files (24.6% non-contiguous), 118274/512000 blocks
File acl would be clean up in release_inode_blocks, whether the orphan
node is truncating or clearing type. If the inode is truncating type,
the file acl would be clean up, but the blocks count is not be
subtract acl blocks, and the inode is not unmark in bitmap, which causes
this issue.
To slove this issue, do not clean up file acl if the inode is truncating
type.
Signed-off-by: LiJinlin <lijinlin3@huawei.com>
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
---
e2fsck/super.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 31e2ffb..ec28426 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -235,6 +235,10 @@ static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino,
if (pb.truncated_blocks)
ext2fs_iblk_sub_blocks(fs, EXT2_INODE(inode),
pb.truncated_blocks);
+
+ /* do not clean up file acl if the inode is truncating type */
+ if (inode->i_links_count)
+ return 0;
blk = ext2fs_file_acl_block(fs, EXT2_INODE(inode));
if (blk) {
--
1.8.3.1
@@ -0,0 +1,74 @@
From 508b1b57f73a49effc975731f8b76325d45b0e0f Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Fri, 18 Mar 2022 00:02:50 +0800
Subject: [PATCH] e2fsck: handle->level is overflow in ext2fs_extent_get.
In function check_blocks_extents, program call scan_extent_node recursively until
leaf extent is found, and if this leaf extent is the last one in this extent_idx,
it will delete the parent extent_idx of this leaf extent in ext2fs_extent_delete,
and do handle->level--. After scan_extent_node return, program allways to get up extent,
but level was already decreased.
So calling ext2fs_extent_get(EXT2_EXTENT_UP) again will return EXT2_ET_EXTENT_NO_UP,
and then print failed.
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
---
e2fsck/pass1.c | 7 +++++++
lib/ext2fs/ext2fs.h | 1 +
lib/ext2fs/extent.c | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 26b9ab71..3d698934 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -3074,11 +3074,18 @@ report_problem:
}
}
}
+
+ int level_bak = ext2fs_current_level_get(ehandle);
+
scan_extent_node(ctx, pctx, pb, extent.e_lblk,
last_lblk, eof_block, ehandle,
next_try_repairs);
if (pctx->errcode)
return;
+
+ if (level_bak != ext2fs_current_level_get(ehandle))
+ return;
+
pctx->errcode = ext2fs_extent_get(ehandle,
EXT2_EXTENT_UP, &extent);
if (pctx->errcode) {
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 68f9c1fe..d0468f11 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -1333,6 +1333,7 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
extern void ext2fs_extent_free(ext2_extent_handle_t handle);
extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle,
int flags, struct ext2fs_extent *extent);
+extern int ext2fs_current_level_get(ext2_extent_handle_t handle);
extern errcode_t ext2fs_extent_node_split(ext2_extent_handle_t handle);
extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags,
struct ext2fs_extent *extent);
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index b324c7b0..07acd4e0 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -575,6 +575,11 @@ retry:
return 0;
}
+int ext2fs_current_level_get(ext2_extent_handle_t handle)
+{
+ return handle->level;
+}
+
static errcode_t update_path(ext2_extent_handle_t handle)
{
blk64_t blk;
--
2.27.0
@@ -0,0 +1,55 @@
From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Apr 2022 19:31:48 +0200
Subject: [PATCH] libext2fs: add sanity check to extent manipulation
It is possible to have a corrupted extent tree in such a way that a leaf
node contains zero extents in it. Currently if that happens and we try
to traverse the tree we can end up accessing wrong data, or possibly
even uninitialized memory. Make sure we don't do that.
Additionally make sure that we have a sane number of bytes passed to
memmove() in ext2fs_extent_delete().
Note that e2fsck is currently unable to spot and fix such corruption in
pass1.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Nils Bars <nils_bars@t-online.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113
Addresses: CVE-2022-1304
Addresses-Debian-Bug: #1010263
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/extent.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index b324c7b..1a206a1 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -495,6 +495,10 @@ retry:
ext2fs_le16_to_cpu(eh->eh_entries);
newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max);
+ /* Make sure there is at least one extent present */
+ if (newpath->left <= 0)
+ return EXT2_ET_EXTENT_NO_DOWN;
+
if (path->left > 0) {
ix++;
newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block);
@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)
cp = path->curr;
+ /* Sanity check before memmove() */
+ if (path->left < 0)
+ return EXT2_ET_EXTENT_LEAF_BAD;
+
if (path->left) {
memmove(cp, cp + sizeof(struct ext3_extent_idx),
path->left * sizeof(struct ext3_extent_idx));
--
1.8.3.1
+134
View File
@@ -0,0 +1,134 @@
From 862752ef988c637562196b802504ce5b3cafe9ea Mon Sep 17 00:00:00 2001
From: wuzx <wuzx1226@qq.com>
Date: Thu, 11 Aug 2022 14:58:42 +0000
Subject: [PATCH] e2fsprogs add sw64
Add code related to sw64 in file configure configure.ac aclocal.m4 lib/blkid/llseek.c lib/ext2fs/unix_io.c to support sw64 architecture.
Signed-off-by: wuzx <wuzx1226@qq.com>
---
aclocal.m4 | 13 +++++++++++--
configure | 6 +++---
configure.ac | 2 +-
lib/blkid/llseek.c | 2 +-
lib/ext2fs/unix_io.c | 2 +-
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 0f39d30..206d5b0 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -977,6 +977,12 @@ changequote([,])dnl
[gl_cv_host_cpu_c_abi=i386])
;;
+changequote(,)dnl
+ sw_64* )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=sw_64
+ ;;
+
changequote(,)dnl
alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
changequote([,])dnl
@@ -1242,6 +1248,9 @@ EOF
#ifndef __x86_64__
#undef __x86_64__
#endif
+#ifndef __sw_64__
+#undef __sw_64__
+#endif
#ifndef __alpha__
#undef __alpha__
#endif
@@ -1355,7 +1364,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
- x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | sw_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
@@ -1385,7 +1394,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
# CPUs that only support a 64-bit ABI.
changequote(,)dnl
- alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+ sw_64* | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
changequote([,])dnl
gl_cv_host_cpu_c_abi_32bit=no
diff --git a/configure b/configure
index 405b730..bc483dc 100755
--- a/configure
+++ b/configure
@@ -4462,7 +4462,7 @@ $as_echo_n "checking for additional special compiler flags... " >&6; }
if test "$GCC" = yes
then
case "$host_cpu" in
- alpha) addcflags="-mieee" ;;
+ alpha | sw_64) addcflags="-mieee" ;;
esac
fi
if test "x$addcflags" != x
@@ -7552,7 +7552,7 @@ else
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
- x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | alpha | sw_64 | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
@@ -7581,7 +7581,7 @@ else
;;
# CPUs that only support a 64-bit ABI.
- alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+ sw_64* | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
gl_cv_host_cpu_c_abi_32bit=no
;;
diff --git a/configure.ac b/configure.ac
index 824a93d..6f39955 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,7 @@ AC_MSG_CHECKING(for additional special compiler flags)
if test "$GCC" = yes
then
case "$host_cpu" in
- alpha) addcflags="-mieee" ;;
+ alpha | sw_64) addcflags="-mieee" ;;
esac
fi
if test "x$addcflags" != x
diff --git a/lib/blkid/llseek.c b/lib/blkid/llseek.c
index 5929864..25c613b 100644
--- a/lib/blkid/llseek.c
+++ b/lib/blkid/llseek.c
@@ -88,7 +88,7 @@ static blkid_loff_t my_llseek(int fd, blkid_loff_t offset, int origin)
return (retval == -1 ? (blkid_loff_t) retval : result);
}
-#endif /* __alpha__ || __ia64__ */
+#endif /* __alpha__ || __sw_64__ || __ia64__ */
#endif /* HAVE_LLSEEK */
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index d251c20..e7a2b4e 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -786,7 +786,7 @@ static errcode_t unix_open_channel(const char *name, int fd,
#ifdef __linux__
#undef RLIM_INFINITY
-#if (defined(__alpha__) || ((defined(__sparc__) || defined(__mips__)) && (SIZEOF_LONG == 4)))
+#if (defined(__alpha__) || defined(__sw_64__) || ((defined(__sparc__) || defined(__mips__)) && (SIZEOF_LONG == 4)))
#define RLIM_INFINITY ((unsigned long)(~0UL>>1))
#else
#define RLIM_INFINITY (~0UL)
--
2.33.0
@@ -0,0 +1,38 @@
From 003125b2f00aed8f0a1d8b5bd80fcbb1e8e2f13e Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Thu, 4 Aug 2022 18:33:39 +0800
Subject: [PATCH] tune2fs: do not change j_tail_sequence in journal superblock
The function recover_ext3_journal() in debugfs/journal.c, if the log
replay is over, the j_tail_sequence in journal superblock is not
changed to the value of the last transaction sequence. This will
cause subsequent log commitids to count from the commitid in last
time. After tune2fs -e, the log commitid is counted from the commitid
in last time, if the log ID of the current operation overlaps with
that of the last operation, this will cause logs that were previously
replayed by tune2fs to be replayed here.
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: liangyun <liangyun2@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
debugfs/journal.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/debugfs/journal.c b/debugfs/journal.c
index 095fff00..5bac0d3b 100644
--- a/debugfs/journal.c
+++ b/debugfs/journal.c
@@ -769,6 +769,8 @@ static errcode_t recover_ext3_journal(ext2_filsys fs)
mark_buffer_dirty(journal->j_sb_buffer);
}
+ journal->j_tail_sequence = journal->j_transaction_sequence;
+
errout:
jbd2_journal_destroy_revoke(journal);
jbd2_journal_destroy_revoke_record_cache();
--
2.37.1
@@ -0,0 +1,165 @@
From 6e4cc3d5eeb2dfaa055e652b5390beaa6c3d05da Mon Sep 17 00:00:00 2001
From: "lihaoxiang (F)" <lihaoxiang9@huawei.com>
Date: Thu, 14 Jul 2022 09:32:48 +0800
Subject: [PATCH] debugfs: teach logdump the -n <num_trans> option
The current version's debugfs possessed the function
logdump. Executing with option -O could output the log history. But
when it occurred the block which had no magic number in it's header,
the program would exit.
Sometimes we were locating problems, needed for more transactions that
had replayed instead of the latest batch of transactions and we
weren't hope to display all the history in the meanwhile. So we
introduced the option -n used for controlling the print of history
transactions. Specially, this parameter was depending on the option
-O otherwise it couldn't work.
So in this modification, we used logdump with -O -n <num_trans>. The
-n options causes logdump to continue past a block with a missing
magic nuber. Instead, it will terminate only when the entire log has
been printed or after <num_trans> transactions.
Link: https://lore.kernel.org/r/608df030-593f-8c69-cb65-632a34729d23@huawei.com
Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
debugfs/debugfs.8.in | 13 +++++++++++--
debugfs/logdump.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in
index aa6128a..a3227a8 100644
--- a/debugfs/debugfs.8.in
+++ b/debugfs/debugfs.8.in
@@ -505,7 +505,7 @@ which is a hard link to
.IR filespec .
Note this does not adjust the inode reference counts.
.TP
-.BI logdump " [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]"
+.BI logdump " [-acsOS] [-b block] [-n num_trans ] [-i filespec] [-f journal_file] [output_file]"
Dump the contents of the ext3 journal. By default, dump the journal inode as
specified in the superblock. However, this can be overridden with the
.I \-i
@@ -528,7 +528,7 @@ The
.I \-a
option causes the
.B logdump
-program to print the contents of all of the descriptor blocks.
+to print the contents of all of the descriptor blocks.
The
.I \-b
option causes
@@ -548,6 +548,15 @@ The
option causes logdump to display old (checkpointed) journal entries.
This can be used to try to track down journal problems even after the
journal has been replayed.
+.IP
+The
+.I \-n
+option causes
+.B logdump
+to continue past a journal block which is missing a magic number.
+Instead, it will stop only when the entire log is printed or after
+.I num_trans
+transactions.
.TP
.BI ls " [-l] [-c] [-d] [-p] [-r] filespec"
Print a listing of the files in the directory
diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 6b0133e..614414e 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -48,6 +48,7 @@ enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL};
#define ANY_BLOCK ((blk64_t) -1)
static int dump_all, dump_super, dump_old, dump_contents, dump_descriptors;
+static int64_t dump_counts;
static blk64_t block_to_dump, bitmap_to_dump, inode_block_to_dump;
static unsigned int group_to_dump, inode_offset_to_dump;
static ext2_ino_t inode_to_dump;
@@ -113,9 +114,10 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
bitmap_to_dump = -1;
inode_block_to_dump = ANY_BLOCK;
inode_to_dump = -1;
+ dump_counts = -1;
reset_getopt();
- while ((c = getopt (argc, argv, "ab:ci:f:OsS")) != EOF) {
+ while ((c = getopt (argc, argv, "ab:ci:f:OsSn:")) != EOF) {
switch (c) {
case 'a':
dump_all++;
@@ -148,6 +150,14 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
case 'S':
dump_super++;
break;
+ case 'n':
+ dump_counts = strtol(optarg, &tmp, 10);
+ if (*tmp) {
+ com_err(argv[0], 0,
+ "Bad log counts number - %s", optarg);
+ return;
+ }
+ break;
default:
goto print_usage;
}
@@ -289,7 +299,7 @@ cleanup:
return;
print_usage:
- fprintf(stderr, "%s: Usage: logdump [-acsOS] [-b<block>] [-i<filespec>]\n\t"
+ fprintf(stderr, "%s: Usage: logdump [-acsOS] [-n<num_trans>] [-b<block>] [-i<filespec>]\n\t"
"[-f<journal_file>] [output_file]\n", argv[0]);
}
@@ -369,6 +379,8 @@ static void dump_journal(char *cmdname, FILE *out_file,
int fc_done;
__u64 total_len;
__u32 maxlen;
+ int64_t cur_counts = 0;
+ bool exist_no_magic = false;
/* First, check to see if there's an ext2 superblock header */
retval = read_journal_block(cmdname, source, 0, buf, 2048);
@@ -459,6 +471,9 @@ static void dump_journal(char *cmdname, FILE *out_file,
}
while (1) {
+ if (dump_old && (dump_counts != -1) && (cur_counts >= dump_counts))
+ break;
+
retval = read_journal_block(cmdname, source,
((ext2_loff_t) blocknr) * blocksize,
buf, blocksize);
@@ -472,8 +487,16 @@ static void dump_journal(char *cmdname, FILE *out_file,
blocktype = be32_to_cpu(header->h_blocktype);
if (magic != JBD2_MAGIC_NUMBER) {
- fprintf (out_file, "No magic number at block %u: "
- "end of journal.\n", blocknr);
+ if (exist_no_magic == false) {
+ exist_no_magic = true;
+ fprintf(out_file, "No magic number at block %u: "
+ "end of journal.\n", blocknr);
+ }
+ if (dump_old && (dump_counts != -1)) {
+ blocknr++;
+ WRAP(jsb, blocknr, maxlen);
+ continue;
+ }
break;
}
@@ -500,6 +523,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
continue;
case JBD2_COMMIT_BLOCK:
+ cur_counts++;
transaction++;
blocknr++;
WRAP(jsb, blocknr, maxlen);
--
1.8.3.1
@@ -0,0 +1,57 @@
From 66ecb6abe5d2c74191bb4bc24f3da036e5fa1213 Mon Sep 17 00:00:00 2001
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Date: Mon, 5 Sep 2022 19:16:03 +0800
Subject: [PATCH] tune2fs: fix tune2fs segfault when ext2fs_run_ext3_journal()
fails
When ext2fs_run_ext3_journal() fails, tune2fs cmd will occur one
segfault problem as follows.
(gdb) bt
#0 0x00007fdadad69917 in ext2fs_mmp_stop (fs=0x0) at mmp.c:405
#1 0x0000558fa5a9365a in main (argc=<optimized out>, argv=<optimized out>) at tune2fs.c:3440
misc/tune2fs.c:
main()
-> ext2fs_open2(&fs)
-> ext2fs_mmp_start
......
-> retval = ext2fs_run_ext3_journal(&fs)
-> if (retval)
// if ext2fs_run_ext3_journal fails, close and free fs.
-> ext2fs_close_free(&fs)
-> rc = 1
-> goto closefs
......
closefs:
-> if (rc)
-> ext2fs_mmp_stop(fs) // fs has been set to NULL, boom!!
-> (ext2fs_close_free(&fs) ? 1 : 0); // close and free fs
In main() of tune2fs cmd, if ext2fs_run_ext3_journal() fails,
we should set rc=1 and goto closefs tag, in which will release fs
resource.
Fix: a2292f8a5108 ("tune2fs: reset MMP state on error exit")
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/tune2fs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index a7ff16de..98e38983 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3106,8 +3106,6 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
com_err("tune2fs", retval,
"while recovering journal.\n");
printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
- if (fs)
- ext2fs_close_free(&fs);
rc = 1;
goto closefs;
}
--
2.33.0
@@ -0,0 +1,39 @@
From 77ac16dfba42e0d152b1e99359e01a933f8cc6f9 Mon Sep 17 00:00:00 2001
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Date: Mon, 5 Sep 2022 23:40:01 +0800
Subject: [PATCH] tune2fs: tune2fs_main() should return rc when some error,
occurs
If some error occurs, tune2fs_main() will go to closefs tag for
releasing resource, and it should return correct value (rc) instead
of 0 when ext2fs_close_free(&fs) successes.
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
misc/tune2fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 98e38983..bed3d95b 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3243,6 +3243,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
fputs(_("Error in using clear_mmp. "
"It must be used with -f\n"),
stderr);
+ rc = 1;
goto closefs;
}
}
@@ -3447,5 +3448,5 @@ closefs:
if (feature_64bit)
convert_64bit(fs, feature_64bit);
- return (ext2fs_close_free(&fs) ? 1 : 0);
+ return (ext2fs_close_free(&fs) ? 1 : rc);
}
--
2.33.0
@@ -0,0 +1,35 @@
From 3d967e53033c85ad5d3af1a42efb2c4f7501c356 Mon Sep 17 00:00:00 2001
From: lijinlin3@huawei.com
Date: Fri, 16 Sep 2022 18:15:02 +0200
Subject: [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal
In ext2fs_run_ext3_journal(), fs will be free and reallocate. But
reallocating by ext2fs_open() may fail in some cases, such as device
being offline at the same time. In these cases, goto closefs will
cause segfault, fix it by exiting directly.
Signed-off-by: Li Jinlin <lijinlin3@huawei.com>
---
misc/tune2fs.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 088f87e5..ee57dc7c 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3344,8 +3344,11 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
com_err("tune2fs", retval,
"while recovering journal.\n");
printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
- rc = 1;
- goto closefs;
+ if (fs) {
+ rc = 1;
+ goto closefs;
+ }
+ exit(1);
}
sb = fs->super;
}
--
2.23.0
@@ -0,0 +1,217 @@
From 8625b843ab9e1327dcb83b025951f97c971175e0 Mon Sep 17 00:00:00 2001
From: Wenchao Hao <haowenchao@huawei.com>
Date: Fri, 11 Nov 2022 12:22:08 +0800
Subject: [PATCH] unix_io.c: fix deadlock problem in unix_write_blk64
We will release CACHE_MTX lock, when enter e2fsck_handle_write_error.
stack:
(gdb) bt
0 0x0000ffffa740bc34 in ?? () from /usr/lib64/libc.so.6
1 0x0000ffffa7412024 in pthread_mutex_lock () from /usr/lib64/libc.so.6
2 0x0000ffffa7654e54 in mutex_lock (kind=CACHE_MTX, data=0xaaaaf5c98f30) at unix_io.c:151
3 unix_write_blk64 (channel=0xaaaaf5c98e60, block=2, count=4, buf=0xaaaaf5c9d170) at unix_io.c:1092
4 0x0000ffffa762e610 in ext2fs_flush2 (flags=0, fs=0xaaaaf5c98cc0) at closefs.c:401
5 ext2fs_flush2 (fs=0xaaaaf5c98cc0, flags=0) at closefs.c:279
6 0x0000ffffa762eb14 in ext2fs_close2 (fs=fs@entry=0xaaaaf5c98cc0, flags=flags@entry=0) at closefs.c:510
7 0x0000ffffa762eba4 in ext2fs_close_free (fs_ptr=fs_ptr@entry=0xffffc8cbab30) at closefs.c:472
8 0x0000aaaadcc39bd8 in preenhalt (ctx=ctx@entry=0xaaaaf5c98460) at util.c:365
9 0x0000aaaadcc3bc5c in e2fsck_handle_write_error (channel=<optimized out>, block=262152, count=<optimized out>, data=<optimized out>, size=<optimized out>, actual=<optimized out>, error=5)
at ehandler.c:114
10 0x0000ffffa7655044 in reuse_cache (block=262206, cache=0xaaaaf5c98f80, data=0xaaaaf5c98f30, channel=0xaaaaf5c98e60) at unix_io.c:583
11 unix_write_blk64 (channel=0xaaaaf5c98e60, block=262206, count=<optimized out>, buf=<optimized out>) at unix_io.c:1097
12 0x0000aaaadcc3702c in ll_rw_block (rw=rw@entry=1, op_flags=op_flags@entry=0, nr=<optimized out>, nr@entry=1, bhp=0xffffc8cbac60, bhp@entry=0xffffc8cbac58) at journal.c:184
13 0x0000aaaadcc375e8 in brelse (bh=<optimized out>, bh@entry=0xaaaaf5cac4a0) at journal.c:217
14 0x0000aaaadcc3ebe0 in do_one_pass (journal=journal@entry=0xaaaaf5c9f590, info=info@entry=0xffffc8cbad60, pass=pass@entry=PASS_REPLAY) at recovery.c:693
15 0x0000aaaadcc3ee74 in jbd2_journal_recover (journal=0xaaaaf5c9f590) at recovery.c:310
16 0x0000aaaadcc386a8 in recover_ext3_journal (ctx=0xaaaaf5c98460) at journal.c:1653
17 e2fsck_run_ext3_journal (ctx=0xaaaaf5c98460) at journal.c:1706
18 0x0000aaaadcc207e0 in main (argc=<optimized out>, argv=<optimized out>) at unix.c:1791
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
lib/ext2fs/unix_io.c | 63 +++++++++++++++++++++++++++++++++++++---------------
1 file changed, 45 insertions(+), 18 deletions(-)
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index c326f57..a7ab772 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -210,7 +210,8 @@ static char *safe_getenv(const char *arg)
static errcode_t raw_read_blk(io_channel channel,
struct unix_private_data *data,
unsigned long long block,
- int count, void *bufv)
+ int count, void *bufv,
+ int cache_lock)
{
errcode_t retval;
ssize_t size;
@@ -331,16 +332,22 @@ error_unlock:
mutex_unlock(data, BOUNCE_MTX);
if (actual >= 0 && actual < size)
memset((char *) buf+actual, 0, size-actual);
- if (channel->read_error)
+ if (channel->read_error) {
+ if (cache_lock)
+ mutex_unlock(data, CACHE_MTX);
retval = (channel->read_error)(channel, block, count, buf,
size, actual, retval);
+ if (cache_lock)
+ mutex_lock(data, CACHE_MTX);
+ }
return retval;
}
static errcode_t raw_write_blk(io_channel channel,
struct unix_private_data *data,
unsigned long long block,
- int count, const void *bufv)
+ int count, const void *bufv,
+ int cache_lock)
{
ssize_t size;
ext2_loff_t location;
@@ -482,9 +489,14 @@ bounce_write:
error_unlock:
mutex_unlock(data, BOUNCE_MTX);
error_out:
- if (channel->write_error)
+ if (channel->write_error) {
+ if (cache_lock)
+ mutex_unlock(data, CACHE_MTX);
retval = (channel->write_error)(channel, block, count, buf,
size, actual, retval);
+ if (cache_lock)
+ mutex_lock(data, CACHE_MTX);
+ }
return retval;
}
@@ -576,16 +588,22 @@ static struct unix_cache *find_cached_block(struct unix_private_data *data,
/*
* Reuse a particular cache entry for another block.
*/
-static void reuse_cache(io_channel channel, struct unix_private_data *data,
+static errcode_t reuse_cache(io_channel channel, struct unix_private_data *data,
struct unix_cache *cache, unsigned long long block)
{
- if (cache->dirty && cache->in_use)
- raw_write_blk(channel, data, cache->block, 1, cache->buf);
+ errcode_t retval = 0;
+ if (cache->dirty && cache->in_use) {
+ retval = raw_write_blk(channel, data, cache->block, 1, cache->buf, 1);
+ if (retval)
+ return retval;
+ }
cache->in_use = 1;
cache->dirty = 0;
cache->block = block;
cache->access_time = ++data->access_time;
+
+ return retval;
}
#define FLUSH_INVALIDATE 0x01
@@ -616,7 +634,8 @@ static errcode_t flush_cached_blocks(io_channel channel,
continue;
retval = raw_write_blk(channel, data,
- cache->block, 1, cache->buf);
+ cache->block, 1, cache->buf,
+ !(flags & FLUSH_NOLOCK));
if (retval)
retval2 = retval;
else
@@ -984,10 +1003,10 @@ static errcode_t unix_read_blk64(io_channel channel, unsigned long long block,
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
#ifdef NO_IO_CACHE
- return raw_read_blk(channel, data, block, count, buf);
+ return raw_read_blk(channel, data, block, count, buf, 0);
#else
if (data->flags & IO_FLAG_NOCACHE)
- return raw_read_blk(channel, data, block, count, buf);
+ return raw_read_blk(channel, data, block, count, buf, 0);
/*
* If we're doing an odd-sized read or a very large read,
* flush out the cache and then do a direct read.
@@ -995,7 +1014,7 @@ static errcode_t unix_read_blk64(io_channel channel, unsigned long long block,
if (count < 0 || count > WRITE_DIRECT_SIZE) {
if ((retval = flush_cached_blocks(channel, data, 0)))
return retval;
- return raw_read_blk(channel, data, block, count, buf);
+ return raw_read_blk(channel, data, block, count, buf, 0);
}
cp = buf;
@@ -1024,14 +1043,18 @@ static errcode_t unix_read_blk64(io_channel channel, unsigned long long block,
printf("Reading %d blocks starting at %lu\n", i, block);
#endif
mutex_unlock(data, CACHE_MTX);
- if ((retval = raw_read_blk(channel, data, block, i, cp)))
+ if ((retval = raw_read_blk(channel, data, block, i, cp, 0)))
return retval;
mutex_lock(data, CACHE_MTX);
/* Save the results in the cache */
for (j=0; j < i; j++) {
if (!find_cached_block(data, block, &cache)) {
- reuse_cache(channel, data, cache, block);
+ retval = reuse_cache(channel, data, cache, block);
+ if (retval) {
+ mutex_unlock(data, CACHE_MTX);
+ return retval;
+ }
memcpy(cache->buf, cp, channel->block_size);
}
count--;
@@ -1064,10 +1087,10 @@ static errcode_t unix_write_blk64(io_channel channel, unsigned long long block,
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
#ifdef NO_IO_CACHE
- return raw_write_blk(channel, data, block, count, buf);
+ return raw_write_blk(channel, data, block, count, buf, 0);
#else
if (data->flags & IO_FLAG_NOCACHE)
- return raw_write_blk(channel, data, block, count, buf);
+ return raw_write_blk(channel, data, block, count, buf, 0);
/*
* If we're doing an odd-sized write or a very large write,
* flush out the cache completely and then do a direct write.
@@ -1076,7 +1099,7 @@ static errcode_t unix_write_blk64(io_channel channel, unsigned long long block,
if ((retval = flush_cached_blocks(channel, data,
FLUSH_INVALIDATE)))
return retval;
- return raw_write_blk(channel, data, block, count, buf);
+ return raw_write_blk(channel, data, block, count, buf, 0);
}
/*
@@ -1086,7 +1109,7 @@ static errcode_t unix_write_blk64(io_channel channel, unsigned long long block,
*/
writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH;
if (writethrough)
- retval = raw_write_blk(channel, data, block, count, buf);
+ retval = raw_write_blk(channel, data, block, count, buf, 0);
cp = buf;
mutex_lock(data, CACHE_MTX);
@@ -1094,7 +1117,11 @@ static errcode_t unix_write_blk64(io_channel channel, unsigned long long block,
cache = find_cached_block(data, block, &reuse);
if (!cache) {
cache = reuse;
- reuse_cache(channel, data, cache, block);
+ retval = reuse_cache(channel, data, cache, block);
+ if (retval) {
+ mutex_unlock(data, CACHE_MTX);
+ return retval;
+ }
}
if (cache->buf != cp)
memcpy(cache->buf, cp, channel->block_size);
--
1.8.3.1
+21 -8
View File
@@ -29,16 +29,29 @@
<policyitem type="compatibility" name="BSDStyleLicense|LGPLStyleLicense" path=".*" desc="Compile tool not runs target, running on host build environment only."/>
<policyitem type="compatibility" name="InvalidLicense" path=".*" desc="Compile tool not runs target, running on host build environment only."/>
<policyitem type="compatibility" name="GPL-2.0-or-later" path=".*" desc="Compile tool not runs target, running on host build environment only."/>
<policyitem type="compatibility" name="LGPL-2.1" path=".*" desc="Compile tool not runs target, running on host build environment only."/>
<policyitem type="compatibility" name="Latex2e" path=".*" desc="It's not a license, OAT tools check error."/>
</policy>
</policylist>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file polices" >
<filteritem type="filename" name="*.gmo|*.bz2|*.gz|*.po|*.so|*.xz" desc="original files"/>
<filteritem type="filepath" name="prebuilt/target/bin/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/target/lib/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/host/bin/.*" desc="original bins"/>
<filteritem type="filepath" name="tests/.*" desc="original bins"/>
<filteritem type="filepath" name="./.*" desc="original bins"/>
</filefilter>
<filefilterlist>
<filefilterlist>
<filefilter name="defaultFilter" desc="Files not to check">
<filteritem type="filename" name="*.gmo|*.bz2|*.gz|*.po|*.so|*.xz" desc="original files"/>
<filteritem type="filename" name="e2fsprogs.spec"/>
<filteritem type="filename" name="install.sh"/>
<filteritem type="filepath" name="prebuilt/target/bin/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/target/lib/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/host/bin/.*" desc="original bins"/>
<filteritem type="filepath" name="tests/.*" desc="original bins"/>
<filteritem type="filepath" name="./.*" desc="original bins"/>
</filefilter>
<filefilter name="binartFileTypePolicyFilter" desc="Filters for binary file polices">
<filteritem type="filepath" name="dir name underproject/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/target/lib/.*" desc="original bins"/>
<filteritem type="filepath" name="prebuilt/host/bin/.*" desc="original bins"/>
<filteritem type="filepath" name="./.*" desc="original bins"/>
</filefilter>
</filefilterlist>
</filefilterlist>
</oatconfig>
</configuration>
+2 -2
View File
@@ -3,9 +3,9 @@
"Name" : "openEuler:e2fsprogs",
"License" : "LGPL V2.0, BSD 3-Clause License, GPL V2.0, MIT License",
"License File" : "e2fsprogs/NOTICE",
"Version Number" : "1.46.4-7.oe2203",
"Version Number" : "1.46.4-17.oe2203sp1",
"Owner" : "liuzhiqiang26@huawei.com",
"Upstream URL" : "https://repo.openeuler.org/openEuler-22.03-LTS/source/Packages/e2fsprogs-1.46.4-7.oe2203.src.rpm",
"Upstream URL" : "https://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/Packages/e2fsprogs-1.46.4-17.oe2203sp1.src.rpm",
"Description" : "The E2fsprogs package contains the utilities for handling the ext2 file system. It also supports the ext3 and ext4 journaling file systems"
}
]
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@ohos/e2fsprogs",
"description": "The E2fsprogs package contains the utilities for handling the ext2 file system. It also supports the ext3 and ext4 journaling file systems",
"version": "3.1",
"version": "4.1",
"license": "LGPL V2.0, BSD 3-Clause License, GPL V2.0, MIT License",
"publishAs": "code-segment",
"segment": {
@@ -35,4 +35,4 @@
"test": []
}
}
}
}
Binary file not shown.
+68 -8
View File
@@ -1,10 +1,11 @@
Name: e2fsprogs
Version: 1.46.4
Release: 7
Release: 17
Summary: Second extended file system management tools
License: GPLv2+ and LGPLv2 and MIT
URL: http://e2fsprogs.sourceforge.net/
Source0: https://www.kernel.org/pub/linux/kernel/people/tytso/%{name}/v%{version}/%{name}-%{version}.tar.xz
Source1: ext2_types-wrapper.h
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
@@ -17,7 +18,17 @@ Patch8: 0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch
Patch9: 0009-e2mmpstatus.8.in-detele-filesystem-can-be-UUID-or-LA.patch
Patch10: 0010-tests-update-expect-file-for-u_direct_io.patch
Patch11: 0011-libext2fs-don-t-old-the-CACHE_MTX-while-doing-I-O.patch
Patch12: 0012-tests-skip-m_rootdir_acl-if-selinux-is-not-disabled.patch
Patch12: 0012-tests-fix-ACL-printing-tests.patch
Patch13: 0013-e2fsck-do-not-clean-up-file-acl-if-the-inode-is-trun.patch
Patch14: 0014-e2fsck-handle-level-is-overflow-in-ext2fs_extent_get.patch
Patch15: 0015-libext2fs-add-sanity-check-to-extent-manipulation.patch
Patch16: 0016-e2fsprogs-add-sw64.patch
Patch17: 0017-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch
Patch18: 0018-debugfs-teach-logdump-the-n-num_trans-option.patch
Patch19: 0019-tune2fs-fix-tune2fs-segfault-when-ext2fs_run_ext3_jo.patch
Patch20: 0020-tune2fs-tune2fs_main-should-return-rc-when-some-erro.patch
Patch21: 0021-tune2fs-exit-directly-when-fs-freed-in-ext2fs_run_ext3_journal.patch
Patch22: 0022-unix_io.c-fix-deadlock-problem-in-unix_write_blk64.patch
BuildRequires: gcc pkgconfig texinfo
@@ -80,11 +91,28 @@ make install install-libs DESTDIR=%{buildroot} INSTALL="%{__install} -p" \
root_sbindir=%{_sbindir} root_libdir=%{_libdir}
chmod +w %{buildroot}%{_libdir}/*.a
# Replace arch-dependent header file with arch-independent stub (when needed).
#%multilib_fix_c_header --file %{_includedir}/ext2fs/ext2_types.h
# ugly hack to allow parallel install of 32-bit and 64-bit -devel packages:
%define multilib_arches %{ix86} x86_64
%ifarch %{multilib_arches}
mv -f %{buildroot}%{_includedir}/ext2fs/ext2_types.h \
%{buildroot}%{_includedir}/ext2fs/ext2_types-%{_arch}.h
install -p -m 644 %{SOURCE1} %{buildroot}%{_includedir}/ext2fs/ext2_types.h
%endif
%find_lang %{name}
rm -f %{buildroot}/etc/cron.d/e2scrub_all
rm -f %{buildroot}%{_libdir}/e2fsprogs/e2scrub_all_cron
%ifarch i686
rm -rf %{buildroot}%{_unitdir}/e2scrub*
%endif
%check
make fullcheck
@@ -116,7 +144,9 @@ exit 0
%{_libdir}/libss.so.*
%{_sbindir}/*
%{_udevrulesdir}/*.rules
%ifnarch i686
%{_unitdir}/e2scrub*
%endif
%files devel
%{_bindir}/compile_et
@@ -140,13 +170,43 @@ exit 0
%{_mandir}/man8/*
%changelog
* Thu Feb 17 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-7
* Thu Dec 1 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.46.4-17
- fix deadlock problem in unix_write_blk64
* Fri Oct 14 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.46.4-16
- tune2fs: fix segfault problem
* Fri Sep 23 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-15
- test: fix ACL-printing tests from community
* Sat Aug 20 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.46.4-14
- debugfs: teach logdump the -n <num_trans> option
* Fri Aug 12 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-13
- tune2fs: do not change j_tail_sequence in journal superblock
* Fri Jun 24 2022 wuzx<wuzx1226@qq.com> - 1.46.4-12
- add sw64 patch
* Tue Jun 21 2022 lihaoxiang <lihaoxiang9@huawei.com> - 1.46.4-11
- DESC:add wrapper header file for i686 and x86_64 then fix conflicts when intall i686 rpms.
* Sat May 28 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.46.4-10
- fix CVE-2022-1304
* Fri May 20 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-9
- e2fsck: handle->level is overflow in ext2fs_extent_get.
* Wed May 18 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-8
- e2fsck: do not clean up file acl if the inode is truncating type
* Thu Mar 17 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-7
- tests: skip m_rootdir_acl if selinux is not disabled
* Wed Feb 9 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-6
* Wed Mar 9 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-6
- libext2fs: don't old the CACHE_MTX while doing I/O
* Thu Feb 8 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-5
* Tue Mar 8 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-5
- tests: update expect file for u_direct_io
* Wed Mar 2 2022 zhanchengbin <zhanchengbin1@huawei.com> - 1.46.4-4
@@ -164,7 +224,7 @@ exit 0
* Mon Nov 15 2021 zhanchengbin <zhanchengbin1@huawei.com> - 1.45.6-7
- DESC: integrate community patches.
* Sun Sep 13 2021 lixiaokeng <lixiaokeng@huawei.com> - 1.45.6-6
* Mon Sep 13 2021 lixiaokeng <lixiaokeng@huawei.com> - 1.45.6-6
- DESC: add newer libreadline.so.8 to dlopen path
* Fri Aug 20 2021 chenyanpanHW <chenyanpan@huawei.com> - 1.45.6-5
@@ -203,13 +263,13 @@ exit 0
- SUG:NA
- DESC:fix local rpmbuild error.
* Mon Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.45.3-1
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 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 <buildteam@openeuler.org> - 1.45.3-0
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.45.3-0
- Type:enhancement
- ID:NA
- SUG:NA
+14
View File
@@ -0,0 +1,14 @@
/* This file is here to prevent a file conflict on multiarch systems. A
* conflict will occur because ext2_types.h has arch-specific definitions.
*
* DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */
#if defined(__i386__)
#include "ext2_types-i386.h"
#elif defined(__x86_64__)
#include "ext2_types-x86_64.h"
#elif defined(__arm__)
#include "ext2_types-arm.h"
#else
#error "This e2fsprogs-devel package does not work your architecture?"
#endif
+12 -1
View File
@@ -12,6 +12,7 @@ if [ -d "e2fsprogs" ];then
exit 0
fi
tar xvf e2fsprogs-1.46.4.tar.xz
mv e2fsprogs-1.46.4 e2fsprogs
cd $1/e2fsprogs
patch -p1 < $1/0001-e2fsprogs-set-hugefile-from-4T-to-1T-in-hugefile-tes.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0002-libss-add-newer-libreadline.so.8-to-dlopen-path.patch --fuzz=0 --no-backup-if-mismatch
@@ -24,7 +25,17 @@ patch -p1 < $1/0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch --fuzz=0
patch -p1 < $1/0009-e2mmpstatus.8.in-detele-filesystem-can-be-UUID-or-LA.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0010-tests-update-expect-file-for-u_direct_io.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0011-libext2fs-don-t-old-the-CACHE_MTX-while-doing-I-O.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0012-tests-skip-m_rootdir_acl-if-selinux-is-not-disabled.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0012-tests-fix-ACL-printing-tests.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0013-e2fsck-do-not-clean-up-file-acl-if-the-inode-is-trun.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0014-e2fsck-handle-level-is-overflow-in-ext2fs_extent_get.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0015-libext2fs-add-sanity-check-to-extent-manipulation.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0016-e2fsprogs-add-sw64.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0017-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0018-debugfs-teach-logdump-the-n-num_trans-option.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0019-tune2fs-fix-tune2fs-segfault-when-ext2fs_run_ext3_jo.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0020-tune2fs-tune2fs_main-should-return-rc-when-some-erro.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0021-tune2fs-exit-directly-when-fs-freed-in-ext2fs_run_ext3_journal.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/0022-unix_io.c-fix-deadlock-problem-in-unix_write_blk64.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/1001-image-make.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/1002-add-header-file-to-musl-compile-mk2efs.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/1003-add-dac-config.patch --fuzz=0 --no-backup-if-mismatch