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

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