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

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