Backport patches from mainline
Signed-off-by: Wenchao Hao <haowenchao2@huawei.com> (cherry picked from commit 871ef2f92166cfa7c569eb4fb1c42e10944d1589)
This commit is contained in:
parent
727f634059
commit
123acfedcf
@ -0,0 +1,49 @@
|
||||
From 29d83fef9e6eab139516afe433c03d975e85c25b Mon Sep 17 00:00:00 2001
|
||||
From: Srivathsa Dara <srivathsa.d.dara@oracle.com>
|
||||
Date: Thu, 24 Aug 2023 06:56:34 +0000
|
||||
Subject: [PATCH] debugfs: Use the hash_version from superblock if a file
|
||||
system is opened
|
||||
|
||||
The debugfs program's dx_hash command computes the hash for the given
|
||||
filename, taking the hash_seed and hash_version (i.e hash algorithm)
|
||||
as arguments. So the user has to refer to the superblock to get these
|
||||
values used by the filesystem. So if debugfs has an opened file
|
||||
system, use those values from the current file system.
|
||||
|
||||
[ Fixed patch to avoid crashing when a file system is not opened. --TYT ]
|
||||
|
||||
Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
|
||||
Link: https://lore.kernel.org/r/20230824065634.2662858-1-srivathsa.d.dara@oracle.com
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
debugfs/htree.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debugfs/htree.c b/debugfs/htree.c
|
||||
index a9f9211b..a3e95ddb 100644
|
||||
--- a/debugfs/htree.c
|
||||
+++ b/debugfs/htree.c
|
||||
@@ -336,11 +336,18 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
|
||||
errcode_t err;
|
||||
int c;
|
||||
int hash_version = 0;
|
||||
- __u32 hash_seed[4];
|
||||
+ __u32 hash_seed[4] = { 0, };
|
||||
int hash_flags = 0;
|
||||
const struct ext2fs_nls_table *encoding = NULL;
|
||||
|
||||
- hash_seed[0] = hash_seed[1] = hash_seed[2] = hash_seed[3] = 0;
|
||||
+ if (current_fs) {
|
||||
+ hash_seed[0] = current_fs->super->s_hash_seed[0];
|
||||
+ hash_seed[1] = current_fs->super->s_hash_seed[1];
|
||||
+ hash_seed[2] = current_fs->super->s_hash_seed[2];
|
||||
+ hash_seed[3] = current_fs->super->s_hash_seed[3];
|
||||
+
|
||||
+ hash_version = current_fs->super->s_def_hash_version;
|
||||
+ }
|
||||
|
||||
reset_getopt();
|
||||
while ((c = getopt(argc, argv, "h:s:ce:")) != EOF) {
|
||||
--
|
||||
2.32.0
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
From d5296ff0c665c1f957252ee18f824ad666a34b78 Mon Sep 17 00:00:00 2001
|
||||
From: Baokun Li <libaokun1@huawei.com>
|
||||
Date: Fri, 17 Feb 2023 18:09:22 +0800
|
||||
Subject: [PATCH] tune2fs/fuse2fs/debugfs: save error information during
|
||||
journal replay
|
||||
|
||||
Saving error information during journal replay, as in the kernel,
|
||||
prevents information loss from making problems difficult to locate.
|
||||
We save these error information until someone uses e2fsck to check
|
||||
for and fix possible errors.
|
||||
|
||||
Signed-off-by: Baokun Li <libaokun1@huawei.com>
|
||||
Reviewed-by: zhanchengbin <zhanchengbin1@huawei.com>
|
||||
Reviewed-by: Jan Kara <jack@suse.cz>
|
||||
Link: https://lore.kernel.org/r/20230217100922.588961-3-libaokun1@huawei.com
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
debugfs/journal.c | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debugfs/journal.c b/debugfs/journal.c
|
||||
index 5bac0d3b..79e3fff8 100644
|
||||
--- a/debugfs/journal.c
|
||||
+++ b/debugfs/journal.c
|
||||
@@ -789,6 +789,8 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
|
||||
char *fsname;
|
||||
int fsflags;
|
||||
int fsblocksize;
|
||||
+ char *save;
|
||||
+ __u16 s_error_state;
|
||||
|
||||
if (!(fs->flags & EXT2_FLAG_RW))
|
||||
return EXT2_ET_FILE_RO;
|
||||
@@ -808,6 +810,12 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
|
||||
if (stats && stats->bytes_written)
|
||||
kbytes_written = stats->bytes_written >> 10;
|
||||
|
||||
+ save = malloc(EXT4_S_ERR_LEN);
|
||||
+ if (save)
|
||||
+ memcpy(save, ((char *) fs->super) + EXT4_S_ERR_START,
|
||||
+ EXT4_S_ERR_LEN);
|
||||
+ s_error_state = fs->super->s_state & EXT2_ERROR_FS;
|
||||
+
|
||||
ext2fs_mmp_stop(fs);
|
||||
fsname = fs->device_name;
|
||||
fs->device_name = NULL;
|
||||
@@ -818,11 +826,15 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
|
||||
retval = ext2fs_open(fsname, fsflags, 0, fsblocksize, io_ptr, fsp);
|
||||
ext2fs_free_mem(&fsname);
|
||||
if (retval)
|
||||
- return retval;
|
||||
+ goto outfree;
|
||||
|
||||
fs = *fsp;
|
||||
fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
|
||||
fs->super->s_kbytes_written += kbytes_written;
|
||||
+ fs->super->s_state |= s_error_state;
|
||||
+ if (save)
|
||||
+ memcpy(((char *) fs->super) + EXT4_S_ERR_START, save,
|
||||
+ EXT4_S_ERR_LEN);
|
||||
|
||||
/* Set the superblock flags */
|
||||
ext2fs_clear_recover(fs, recover_retval != 0);
|
||||
@@ -832,6 +844,9 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
|
||||
* the EXT2_ERROR_FS flag in the fs superblock if needed.
|
||||
*/
|
||||
retval = ext2fs_check_ext3_journal(fs);
|
||||
+
|
||||
+outfree:
|
||||
+ free(save);
|
||||
return retval ? retval : recover_retval;
|
||||
}
|
||||
|
||||
--
|
||||
2.32.0
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
From 43a498e938887956f393b5e45ea6ac79cc5f4b84 Mon Sep 17 00:00:00 2001
|
||||
From: Theodore Ts'o <tytso@mit.edu>
|
||||
Date: Thu, 15 Jun 2023 00:17:01 -0400
|
||||
Subject: [PATCH] resize2fs: use Direct I/O when reading the superblock for
|
||||
online resizes
|
||||
|
||||
If the file system is mounted, the superblock can be changing while
|
||||
resize2fs is trying to read the superblock, resulting in checksum
|
||||
failures. One way of avoiding this problem is read the superblock
|
||||
using Direct I/O, since the kernel makes sure that what gets written
|
||||
to disk is self-consistent.
|
||||
|
||||
Suggested-by: Krister Johansen <kjlx@templeofstupid.com>
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
resize/main.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/resize/main.c b/resize/main.c
|
||||
index 94f5ec6d..f914c050 100644
|
||||
--- a/resize/main.c
|
||||
+++ b/resize/main.c
|
||||
@@ -403,6 +403,8 @@ int main (int argc, char ** argv)
|
||||
|
||||
if (!(mount_flags & EXT2_MF_MOUNTED))
|
||||
io_flags = EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE;
|
||||
+ if (mount_flags & EXT2_MF_MOUNTED)
|
||||
+ io_flags |= EXT2_FLAG_DIRECT_IO;
|
||||
|
||||
io_flags |= EXT2_FLAG_64BITS | EXT2_FLAG_THREADS;
|
||||
if (undo_file) {
|
||||
--
|
||||
2.32.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: e2fsprogs
|
||||
Version: 1.46.4
|
||||
Release: 24
|
||||
Release: 25
|
||||
Summary: Second extended file system management tools
|
||||
License: GPLv2+ and LGPLv2 and MIT
|
||||
URL: http://e2fsprogs.sourceforge.net/
|
||||
@ -48,6 +48,9 @@ Patch38: 0038-Quiet-unused-variable-warnings.patch
|
||||
Patch39: 0039-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch
|
||||
Patch40: 0040-e2fsck-fix-bad-htree-checksums-in-preen-mode.patch
|
||||
Patch41: 0041-debugfs-Fix-infinite-loop-when-dump-log.patch
|
||||
Patch42: 0042-debugfs-Use-the-hash_version-from-superblock-if-a-fi.patch
|
||||
Patch43: 0043-tune2fs-fuse2fs-debugfs-save-error-information-durin.patch
|
||||
Patch44: 0044-resize2fs-use-Direct-I-O-when-reading-the-superblock.patch
|
||||
|
||||
BuildRequires: gcc pkgconfig texinfo
|
||||
BuildRequires: fuse-devel libblkid-devel libuuid-devel
|
||||
@ -188,6 +191,9 @@ exit 0
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Sun Apr 7 2024 haowenchao <haowenchao2@huawei.com> - 1.46.4-25
|
||||
- Backports from mainline
|
||||
|
||||
* Tue Dec 19 2023 haowenchao <haowenchao2@huawei.com> - 1.46.4-24
|
||||
- debugfs: Fix infinite loop when dump log
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user