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

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