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