From dfe4464ddfe97ae568524cce16a2c3996ed90701 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 15 Aug 2015 10:46:09 -0400 Subject: [PATCH] add patch dont-manipulate-recovery-flag-when-freezing-no-journal-fs --- ...ulate-recovery-flag-when-freezing-no-journal-fs | 69 ++++++++++++++++++++++ series | 1 + timestamps | 7 ++- 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 dont-manipulate-recovery-flag-when-freezing-no-journal-fs diff --git a/dont-manipulate-recovery-flag-when-freezing-no-journal-fs b/dont-manipulate-recovery-flag-when-freezing-no-journal-fs new file mode 100644 index 00000000..56c732ce --- /dev/null +++ b/dont-manipulate-recovery-flag-when-freezing-no-journal-fs @@ -0,0 +1,69 @@ +ext4: don't manipulate recovery flag when freezing no-journal fs + +From: Eric Sandeen + +At some point along this sequence of changes: + +f6e63f9 ext4: fold ext4_nojournal_sops into ext4_sops +bb04457 ext4: support freezing ext2 (nojournal) file systems +9ca9238 ext4: Use separate super_operations structure for no_journal filesystems + +ext4 started setting needs_recovery on filesystems without journals +when they are unfrozen. This makes no sense, and in fact confuses +blkid to the point where it doesn't recognize the filesystem at all. + +(freeze ext2; unfreeze ext2; run blkid; see no output; run dumpe2fs, +see needs_recovery set on fs w/ no journal). + +To fix this, don't manipulate the INCOMPAT_RECOVER feature on +filesystems without journals. + +Reported-by: Stu Mark +Reviewed-by: Jan Kara +Signed-off-by: Eric Sandeen +Signed-off-by: Theodore Ts'o +Cc: stable@vger.kernel.org +--- + +Note, is there a reason that in ext4_freeze, if journal_flush +fails, we skip the ext4_commit_super call? I didn't change that +here, but it seems odd. + + +-- +To unsubscribe from this list: send the line "unsubscribe linux-ext4" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 58987b5..e7b345d 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -4833,10 +4833,11 @@ static int ext4_freeze(struct super_block *sb) + error = jbd2_journal_flush(journal); + if (error < 0) + goto out; ++ ++ /* Journal blocked and flushed, clear needs_recovery flag. */ ++ EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); + } + +- /* Journal blocked and flushed, clear needs_recovery flag. */ +- EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); + error = ext4_commit_super(sb, 1); + out: + if (journal) +@@ -4854,8 +4855,11 @@ static int ext4_unfreeze(struct super_block *sb) + if (sb->s_flags & MS_RDONLY) + return 0; + +- /* Reset the needs_recovery flag before the fs is unlocked. */ +- EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); ++ if (EXT4_SB(sb)->s_journal) { ++ /* Reset the needs_recovery flag before the fs is unlocked. */ ++ EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); ++ } ++ + ext4_commit_super(sb, 1); + return 0; + } diff --git a/series b/series index 91a953fc..8d940635 100644 --- a/series +++ b/series @@ -13,6 +13,7 @@ avoid-infinite-loop-when-destroying-aborted-journal update-cmtime-on-truncate-up remove-duplicate-header-file limit-number-of-reserved-credits +dont-manipulate-recovery-flag-when-freezing-no-journal-fs ########################################## # unstable patches diff --git a/timestamps b/timestamps index 77d49946..36d9bd39 100755 --- a/timestamps +++ b/timestamps @@ -37,6 +37,7 @@ touch -d @1438109834 avoid-infinite-loop-when-destroying-aborted-journal touch -d @1438110521 update-cmtime-on-truncate-up touch -d @1438110738 remove-duplicate-header-file touch -d @1438701712 limit-number-of-reserved-credits -touch -d @1438701735 series -touch -d @1438701738 status -touch -d @1438702167 timestamps +touch -d @1439649906 dont-manipulate-recovery-flag-when-freezing-no-journal-fs +touch -d @1439649942 series +touch -d @1439649954 status +touch -d @1439649962 timestamps -- 2.11.4.GIT