linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Cc: james.faulkner@yale.edu
Subject: [PATCH] tune2fs: allow removal of dirty journal with two "-f" options
Date: Thu, 09 Jan 2014 14:08:11 -0600	[thread overview]
Message-ID: <52CF01AB.7030704@redhat.com> (raw)

Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the
journal if the needs_recovery flag is set; the manpage seems to indicate
that it should.  And if you've lost an external journal and can no longer
replay it, how should one proceed?

Change tune2fs so that two "-f" options will allow removal of a dirty
journal from a filesystem, even if the filesystem needs recovery.

e2fsck can then do its best to pick up the pieces.

Reported-by: Jim Faulkner <james.faulkner@yale.edu>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index da21080..e07da28 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -248,7 +248,10 @@ option is useful when removing the
 filesystem feature from a filesystem which has 
 an external journal (or is corrupted
 such that it appears to have an external journal), but that 
-external journal is not available.   
+external journal is not available.   If the filesystem appears to require
+journal replay, the
+.B \-f
+flag must be specified twice to proceed.
 .sp
 .B WARNING:
 Removing an external journal from a filesystem which was not cleanly unmounted
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 0eddf6d..2318dbb 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -903,8 +903,9 @@ static int update_feature_set(ext2_filsys fs, char *features)
 				"read-only.\n"), stderr);
 			return 1;
 		}
-		if (sb->s_feature_incompat &
-		    EXT3_FEATURE_INCOMPAT_RECOVER) {
+		if ((sb->s_feature_incompat &
+		    EXT3_FEATURE_INCOMPAT_RECOVER) && 
+		    f_flag < 2) {
 			fputs(_("The needs_recovery flag is set.  "
 				"Please run e2fsck before clearing\n"
 				"the has_journal flag.\n"), stderr);
@@ -1428,7 +1429,7 @@ static void parse_tune2fs_options(int argc, char **argv)
 			open_flag |= EXT2_FLAG_RW;
 			break;
 		case 'f': /* Force */
-			f_flag = 1;
+			f_flag++;
 			break;
 		case 'g':
 			resgid = strtoul(optarg, &tmp, 0);


             reply	other threads:[~2014-01-09 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 20:08 Eric Sandeen [this message]
2014-02-21  1:34 ` [PATCH] tune2fs: allow removal of dirty journal with two "-f" options Theodore Ts'o

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=52CF01AB.7030704@redhat.com \
    --to=sandeen@redhat.com \
    --cc=james.faulkner@yale.edu \
    --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).