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

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