diff options
author | Theodore Ts'o <tytso@mit.edu> | 2023-06-15 00:17:01 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2023-06-15 00:17:01 -0400 |
commit | 43a498e938887956f393b5e45ea6ac79cc5f4b84 (patch) | |
tree | 7f3451c7d780457c5324b6591beb1e2d55f2c4ff | |
parent | 541ce8f2bb6f91834b5d5b7c98bd4de8998dccc5 (diff) | |
download | e2fsprogs-43a498e938887956f393b5e45ea6ac79cc5f4b84.tar.gz |
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>
-rw-r--r-- | resize/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/resize/main.c b/resize/main.c index 94f5ec6d6..f914c0507 100644 --- a/resize/main.c +++ b/resize/main.c @@ -409,6 +409,8 @@ int main (int argc, char ** argv) if (!(mount_flags & EXT2_MF_MOUNTED) && !print_min_size) 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) { |