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

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