linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	"Андрей Василишин" <a.vasilishin@kpi.ua>,
	"Jon Severinsson" <jon@severinsson.net>,
	744953@bugs.debian.org
Subject: [PATCH] e2fsck: reopen the file system with saved flags after a journal replay
Date: Sat,  5 Jul 2014 23:12:05 -0400	[thread overview]
Message-ID: <1404616325-551-1-git-send-email-tytso@mit.edu> (raw)

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
---

Distributions will almost certainly want to backport this commit.  I
plan to release e2fsprogs 1.42.11, which will include this fix.

 e2fsck/e2fsck.h  | 1 +
 e2fsck/journal.c | 2 +-
 e2fsck/unix.c    | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index c71a0a5..998abdc 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -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
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 905c0bf..9be52cd 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -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) {
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index b265c99..03848c7 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -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) &&
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2014-07-06  3:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06  3:12 Theodore Ts'o [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-07-06  3:09 [PATCH] e2fsck: reopen the file system with saved flags after a journal replay Theodore Ts'o
2014-07-08  9:03 ` Lukáš Czerner
2014-07-08 11:58   ` Theodore Ts'o
2014-07-08 12:49     ` Lukáš Czerner
2014-07-08 17:29 ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404616325-551-1-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=744953@bugs.debian.org \
    --cc=a.vasilishin@kpi.ua \
    --cc=jon@severinsson.net \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).