Fix e2fsprogs: online resize fails
Resolves: RHEL-60512 Signed-off-by: Pavel Reichl <preichl@redhat.com>
This commit is contained in:
parent
b54eb36c28
commit
df5d981e19
@ -0,0 +1,54 @@
|
||||
From 6338a8467564c3a0a12e9fcb08bdd748d736ac2f Mon Sep 17 00:00:00 2001
|
||||
From: Theodore Ts'o <tytso@mit.edu>
|
||||
Date: Sun, 17 May 2020 23:05:11 -0400
|
||||
Subject: [PATCH] libext2fs: retry reading superblock on open when checksum is
|
||||
bad
|
||||
|
||||
When opening a file system which is mounted, it's possible that when
|
||||
ext2fs_open2() is racing with the kernel modifying the orphaned inode
|
||||
list, the superblock's checksum could be incorrect. So retry reading
|
||||
the superblock in the hopes that the problem will self-correct.
|
||||
|
||||
Google-Bug-Id: 151453112
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
lib/ext2fs/openfs.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
|
||||
index 51b54a44..ae54870e 100644
|
||||
--- a/lib/ext2fs/openfs.c
|
||||
+++ b/lib/ext2fs/openfs.c
|
||||
@@ -134,6 +134,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
||||
int j;
|
||||
#endif
|
||||
char *time_env;
|
||||
+ int csum_retries = 0;
|
||||
|
||||
EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);
|
||||
|
||||
@@ -221,6 +222,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
}
|
||||
+retry:
|
||||
retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE,
|
||||
fs->super);
|
||||
if (retval)
|
||||
@@ -232,8 +234,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
||||
retval = 0;
|
||||
if (!ext2fs_verify_csum_type(fs, fs->super))
|
||||
retval = EXT2_ET_UNKNOWN_CSUM;
|
||||
- if (!ext2fs_superblock_csum_verify(fs, fs->super))
|
||||
+ if (!ext2fs_superblock_csum_verify(fs, fs->super)) {
|
||||
+ if (csum_retries++ < 3)
|
||||
+ goto retry;
|
||||
retval = EXT2_ET_SB_CSUM_INVALID;
|
||||
+ }
|
||||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
--
|
||||
2.48.1
|
||||
|
@ -0,0 +1,35 @@
|
||||
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>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
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 @@
|
||||
|
||||
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;
|
||||
if (undo_file) {
|
||||
--
|
||||
2.48.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Utilities for managing ext2, ext3, and ext4 file systems
|
||||
Name: e2fsprogs
|
||||
Version: 1.45.6
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
|
||||
# License tags based on COPYING file distinctions for various components
|
||||
License: GPLv2
|
||||
@ -86,6 +86,8 @@ Patch55: e2fsprogs-1.45.6-e2fsck-add-maximum-string-length-specifiers-to-fscan.p
|
||||
Patch56: e2fsprogs-1.45.6-tests-Add-option-to-print-diff-output-of-failed-test.patch
|
||||
Patch57: e2fsprogs-1.45.6-libext2fs-add-sanity-check-to-extent-manipulation.patch
|
||||
Patch58: e2fsprogs-1.45.6-libss-fix-possible-NULL-pointer-dereferece-on-alloca.patch
|
||||
Patch59: e2fsprogs-1.45.7-libext2fs-retry-reading-superblock-on-open-when-chec.patch
|
||||
Patch60: e2fsprogs-1.47.1-resize2fs-use-Direct-I-O-when-reading-the-superblock.patch
|
||||
|
||||
%description
|
||||
The e2fsprogs package contains a number of utilities for creating,
|
||||
@ -263,6 +265,8 @@ It was originally inspired by the Multics SubSystem library.
|
||||
%patch56 -p1
|
||||
%patch57 -p1
|
||||
%patch58 -p1
|
||||
%patch59 -p1
|
||||
%patch60 -p1
|
||||
|
||||
%build
|
||||
%configure CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
|
||||
@ -425,6 +429,10 @@ exit 0
|
||||
%{_libdir}/pkgconfig/ss.pc
|
||||
|
||||
%changelog
|
||||
* Thu Jan 23 2025 Pavel Reichl <preichl@redhat.com> 1.45.6-6
|
||||
- Fix e2fsprogs: online resize fails
|
||||
- Related: RHEL-60512
|
||||
|
||||
* Wed May 11 2022 Lukas Czerner <lczerner@redhat.com> 1.45.6-5
|
||||
- Update e2fsprogs with upstream fixes and improvements (#2083621)
|
||||
- Fix out-of-bounds read/write via crafter filesystem (#2073548)
|
||||
|
Loading…
Reference in New Issue
Block a user