1 ext4: support freezing ext2 (nojournal) file systems
3 Through an oversight, when we added nojournal support to ext4, we
4 didn't add support to allow file system freezing. This is relatively
5 easy to add, so let's do it.
7 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 Reported-by: Dexuan Cui <decui@microsoft.com>
10 fs/ext4/super.c | 27 ++++++++++++++++-----------
11 1 file changed, 16 insertions(+), 11 deletions(-)
13 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
14 index 4770c98..4db537b 100644
17 @@ -1131,6 +1131,8 @@ static const struct super_operations ext4_nojournal_sops = {
18 .drop_inode = ext4_drop_inode,
19 .evict_inode = ext4_evict_inode,
20 .sync_fs = ext4_sync_fs,
21 + .freeze_fs = ext4_freeze,
22 + .unfreeze_fs = ext4_unfreeze,
23 .put_super = ext4_put_super,
24 .statfs = ext4_statfs,
25 .remount_fs = ext4_remount,
26 @@ -4758,23 +4760,26 @@ static int ext4_freeze(struct super_block *sb)
28 journal = EXT4_SB(sb)->s_journal;
30 - /* Now we set up the journal barrier. */
31 - jbd2_journal_lock_updates(journal);
33 + /* Now we set up the journal barrier. */
34 + jbd2_journal_lock_updates(journal);
37 - * Don't clear the needs_recovery flag if we failed to flush
40 - error = jbd2_journal_flush(journal);
44 + * Don't clear the needs_recovery flag if we failed to
45 + * flush the journal.
47 + error = jbd2_journal_flush(journal);
52 /* Journal blocked and flushed, clear needs_recovery flag. */
53 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
54 error = ext4_commit_super(sb, 1);
56 - /* we rely on upper layer to stop further updates */
57 - jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
59 + /* we rely on upper layer to stop further updates */
60 + jbd2_journal_unlock_updates(journal);