Blame SOURCES/e2fsprogs-1.42.9-force-journal-remove.patch

98901c
commit 5fe2bd60844cfe5d805e62a4316afaa5cd9d7c83
98901c
Author: Eric Sandeen <sandeen@redhat.com>
98901c
Date:   Thu Feb 20 20:18:41 2014 -0500
98901c
98901c
    tune2fs: allow removal of dirty journal with two "-f" options
98901c
    
98901c
    Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the
98901c
    journal if the needs_recovery flag is set; the manpage seems to indicate
98901c
    that it should.  And if you've lost an external journal and can no longer
98901c
    replay it, how should one proceed?
98901c
    
98901c
    Change tune2fs so that two "-f" options will allow removal of a dirty
98901c
    journal from a filesystem, even if the filesystem needs recovery.
98901c
    
98901c
    e2fsck can then do its best to pick up the pieces.
98901c
    
98901c
    Addresses-Debian-Bug: #559301
98901c
    
98901c
    Reported-by: Jim Faulkner <james.faulkner@yale.edu>
98901c
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
98901c
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
98901c
98901c
Index: e2fsprogs-1.42.9/misc/tune2fs.8.in
98901c
===================================================================
98901c
--- e2fsprogs-1.42.9.orig/misc/tune2fs.8.in
98901c
+++ e2fsprogs-1.42.9/misc/tune2fs.8.in
98901c
@@ -248,7 +248,10 @@ option is useful when removing the 
98901c
 filesystem feature from a filesystem which has 
98901c
 an external journal (or is corrupted
98901c
 such that it appears to have an external journal), but that 
98901c
-external journal is not available.   
98901c
+external journal is not available.   If the filesystem appears to require
98901c
+journal replay, the
98901c
+.B \-f
98901c
+flag must be specified twice to proceed.
98901c
 .sp
98901c
 .B WARNING:
98901c
 Removing an external journal from a filesystem which was not cleanly unmounted
98901c
Index: e2fsprogs-1.42.9/misc/tune2fs.c
98901c
===================================================================
98901c
--- e2fsprogs-1.42.9.orig/misc/tune2fs.c
98901c
+++ e2fsprogs-1.42.9/misc/tune2fs.c
98901c
@@ -436,8 +436,9 @@ static int update_feature_set(ext2_filsy
98901c
 				"read-only.\n"), stderr);
98901c
 			return 1;
98901c
 		}
98901c
-		if (sb->s_feature_incompat &
98901c
-		    EXT3_FEATURE_INCOMPAT_RECOVER) {
98901c
+		if ((sb->s_feature_incompat &
98901c
+		    EXT3_FEATURE_INCOMPAT_RECOVER) &&
98901c
+		    f_flag < 2) {
98901c
 			fputs(_("The needs_recovery flag is set.  "
98901c
 				"Please run e2fsck before clearing\n"
98901c
 				"the has_journal flag.\n"), stderr);
98901c
@@ -929,7 +930,7 @@ static void parse_tune2fs_options(int ar
98901c
 			open_flag |= EXT2_FLAG_RW;
98901c
 			break;
98901c
 		case 'f': /* Force */
98901c
-			f_flag = 1;
98901c
+			f_flag++;
98901c
 			break;
98901c
 		case 'g':
98901c
 			resgid = strtoul(optarg, &tmp, 0);