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

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