]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: reopen the file system with saved flags after a journal replay
authorTheodore Ts'o <tytso@mit.edu>
Sun, 6 Jul 2014 02:53:29 +0000 (22:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 6 Jul 2014 03:06:39 +0000 (23:06 -0400)
After a journal replay, we close and reopen the file system so that
any changes in the superblock can get reflected in the libext2fs's
internal data structures.  We need to save the flags passed to
ext2fs_open() that we used when we originally opened the file system.

Otherwise we will end up not be able to repair a file system which
requires a journal replay and which has bigalloc enabled or which has
more than 2**32 blocks; e2fsck will abort with the error message:

fsck.ext4: Filesystem too large to use legacy bitmaps while trying to re-open

Addresses-Debian-Bug: 744953
Cc: Андрей Василишин <a.vasilishin@kpi.ua>
Cc: Jon Severinsson <jon@severinsson.net>
Cc: 744953@bugs.debian.org
e2fsck/e2fsck.h
e2fsck/journal.c
e2fsck/unix.c

index c71a0a5471e0101fc61fbe1a466c76e238aeef99..998abdc113c63ee438d73ae6cf3c6af91c6c2d0b 100644 (file)
@@ -232,6 +232,7 @@ struct e2fsck_struct {
        blk64_t free_blocks;
        ino_t   free_inodes;
        int     mount_flags;
+       int     openfs_flags;
        blkid_cache blkid;      /* blkid cache */
 
 #ifdef HAVE_SETJMP_H
index 905c0bf6ff76573337dc6aa51245e2bb90c8755f..9be52cdc82f0bcf737abbcca63d7decd7d89724d 100644 (file)
@@ -903,7 +903,7 @@ errcode_t e2fsck_run_ext3_journal(e2fsck_t ctx)
 
        ext2fs_mmp_stop(ctx->fs);
        ext2fs_free(ctx->fs);
-       retval = ext2fs_open(ctx->filesystem_name, EXT2_FLAG_RW,
+       retval = ext2fs_open(ctx->filesystem_name, ctx->openfs_flags,
                             ctx->superblock, blocksize, io_ptr,
                             &ctx->fs);
        if (retval) {
index b265c99ecee6f2a862c4b3e6786261850b34a2aa..03848c77fe15dc31ec981876653e76575d7a90b4 100644 (file)
@@ -1274,6 +1274,7 @@ restart:
                        flags &= ~EXT2_FLAG_EXCLUSIVE;
        }
 
+       ctx->openfs_flags = flags;
        retval = try_open_fs(ctx, flags, io_ptr, &fs);
 
        if (!ctx->superblock && !(ctx->options & E2F_OPT_PREEN) &&