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

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