Blame SOURCES/e2fsprogs-1.42.9-dont-require-fsck-for-resize-p.patch

bee754
commit 0462fd6db55de28d7e087d8d06ab20339acd8f67
bee754
Author: Eric Sandeen <sandeen@sandeen.net>
bee754
Date:   Sun Dec 14 19:08:59 2014 -0500
bee754
bee754
    resize2fs: don't require fsck to print min size
bee754
    
bee754
    My previous change ended up requiring that the filesystem
bee754
    be fsck'd after the last mount, even if we are only querying
bee754
    the minimum size.  This is a bit draconian, and it burned
bee754
    the Fedora installer, which wants to calculate minimum size
bee754
    for every filesystem in the box at install time, which in turn
bee754
    requires a full fsck of every filesystem.
bee754
    
bee754
    Try this one more time, and separate out the tests to make things
bee754
    a bit more clear.  If we're only printing the min size, don't
bee754
    require the fsck, as this is a bit less dangerous/critical.
bee754
    
bee754
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
bee754
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
bee754
bee754
Index: e2fsprogs-1.42.9/resize/main.c
bee754
===================================================================
bee754
--- e2fsprogs-1.42.9.orig/resize/main.c
bee754
+++ e2fsprogs-1.42.9/resize/main.c
bee754
@@ -319,10 +319,30 @@ int main (int argc, char ** argv)
bee754
 		exit (1);
bee754
 	}
bee754
 
bee754
-	if (!(mount_flags & EXT2_MF_MOUNTED)) {
bee754
-		if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
bee754
-			       (fs->super->s_state & EXT2_ERROR_FS) ||
bee754
-			       ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
bee754
+	/*
bee754
+	 * Before acting on an unmounted filesystem, make sure it's ok,
bee754
+	 * unless the user is forcing it.
bee754
+	 *
bee754
+	 * We do ERROR and VALID checks even if we're only printing the
bee754
+	 * minimimum size, because traversal of a badly damaged filesystem
bee754
+	 * can cause issues as well.  We don't require it to be fscked after
bee754
+	 * the last mount time in this case, though, as this is a bit less
bee754
+	 * risky.
bee754
+	 */
bee754
+	if (!force && !(mount_flags & EXT2_MF_MOUNTED)) {
bee754
+		int checkit = 0;
bee754
+
bee754
+		if (fs->super->s_state & EXT2_ERROR_FS)
bee754
+			checkit = 1;
bee754
+
bee754
+		if ((fs->super->s_state & EXT2_VALID_FS) == 0)
bee754
+			checkit = 1;
bee754
+
bee754
+		if ((fs->super->s_lastcheck < fs->super->s_mtime) &&
bee754
+		    !print_min_size)
bee754
+			checkit = 1;
bee754
+
bee754
+		if (checkit) {
bee754
 			fprintf(stderr,
bee754
 				_("Please run 'e2fsck -f %s' first.\n\n"),
bee754
 				device_name);