487a038
From: Eric Sandeen <sandeen@xxxxxxxxxx>
487a038
Date: Wed, 05 Aug 2015 15:13:58 -0700
487a038
Subject: [PATCH] ext4: don't manipulate recovery flag when freezing no-journal fs
487a038
487a038
At some point along this sequence of changes:
487a038
487a038
f6e63f9 ext4: fold ext4_nojournal_sops into ext4_sops
487a038
bb04457 ext4: support freezing ext2 (nojournal) file systems
487a038
9ca9238 ext4: Use separate super_operations structure for no_journal filesystems
487a038
487a038
ext4 started setting needs_recovery on filesystems without journals
487a038
when they are unfrozen.  This makes no sense, and in fact confuses
487a038
blkid to the point where it doesn't recognize the filesystem at all.
487a038
487a038
(freeze ext2; unfreeze ext2; run blkid; see no output; run dumpe2fs,
487a038
see needs_recovery set on fs w/ no journal).
487a038
487a038
To fix this, don't manipulate the INCOMPAT_RECOVER feature on
487a038
filesystems without journals.
487a038
487a038
Reported-by: Stu Mark <smark@xxxxxxxxx>
487a038
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
487a038
---
487a038
487a038
Note, is there a reason that in ext4_freeze, if journal_flush
487a038
fails, we skip the ext4_commit_super call?  I didn't change that
487a038
here, but it seems odd.
487a038
487a038
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
487a038
index 58987b5..e7b345d 100644
487a038
--- a/fs/ext4/super.c
487a038
+++ b/fs/ext4/super.c
487a038
@@ -4833,10 +4833,11 @@ static int ext4_freeze(struct super_block *sb)
487a038
 		error = jbd2_journal_flush(journal);
487a038
 		if (error < 0)
487a038
 			goto out;
487a038
+
487a038
+		/* Journal blocked and flushed, clear needs_recovery flag. */
487a038
+		EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
487a038
 	}
487a038
 
487a038
-	/* Journal blocked and flushed, clear needs_recovery flag. */
487a038
-	EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
487a038
 	error = ext4_commit_super(sb, 1);
487a038
 out:
487a038
 	if (journal)
487a038
@@ -4854,8 +4855,11 @@ static int ext4_unfreeze(struct super_block *sb)
487a038
 	if (sb->s_flags & MS_RDONLY)
487a038
 		return 0;
487a038
 
487a038
-	/* Reset the needs_recovery flag before the fs is unlocked. */
487a038
-	EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
487a038
+	if (EXT4_SB(sb)->s_journal) {
487a038
+		/* Reset the needs_recovery flag before the fs is unlocked. */
487a038
+		EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
487a038
+	}
487a038
+
487a038
 	ext4_commit_super(sb, 1);
487a038
 	return 0;
487a038
 }
487a038
487a038
--
487a038
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
487a038
the body of a message to majordomo@xxxxxxxxxxxxxxx
487a038
More majordomo info at  http://vger.kernel.org/majordomo-info.html
487a038