Commit bb044576 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: support freezing ext2 (nojournal) file systems

Through an oversight, when we added nojournal support to ext4, we
didn't add support to allow file system freezing.  This is relatively
easy to add, so let's do it.
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reported-by: default avatarDexuan Cui <decui@microsoft.com>
parent bda32530
...@@ -1131,6 +1131,8 @@ static const struct super_operations ext4_nojournal_sops = { ...@@ -1131,6 +1131,8 @@ static const struct super_operations ext4_nojournal_sops = {
.drop_inode = ext4_drop_inode, .drop_inode = ext4_drop_inode,
.evict_inode = ext4_evict_inode, .evict_inode = ext4_evict_inode,
.sync_fs = ext4_sync_fs, .sync_fs = ext4_sync_fs,
.freeze_fs = ext4_freeze,
.unfreeze_fs = ext4_unfreeze,
.put_super = ext4_put_super, .put_super = ext4_put_super,
.statfs = ext4_statfs, .statfs = ext4_statfs,
.remount_fs = ext4_remount, .remount_fs = ext4_remount,
...@@ -4758,23 +4760,26 @@ static int ext4_freeze(struct super_block *sb) ...@@ -4758,23 +4760,26 @@ static int ext4_freeze(struct super_block *sb)
journal = EXT4_SB(sb)->s_journal; journal = EXT4_SB(sb)->s_journal;
if (journal) {
/* Now we set up the journal barrier. */ /* Now we set up the journal barrier. */
jbd2_journal_lock_updates(journal); jbd2_journal_lock_updates(journal);
/* /*
* Don't clear the needs_recovery flag if we failed to flush * Don't clear the needs_recovery flag if we failed to
* the journal. * flush the journal.
*/ */
error = jbd2_journal_flush(journal); error = jbd2_journal_flush(journal);
if (error < 0) if (error < 0)
goto out; goto out;
}
/* Journal blocked and flushed, clear needs_recovery flag. */ /* Journal blocked and flushed, clear needs_recovery flag. */
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
error = ext4_commit_super(sb, 1); error = ext4_commit_super(sb, 1);
out: out:
if (journal)
/* we rely on upper layer to stop further updates */ /* we rely on upper layer to stop further updates */
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); jbd2_journal_unlock_updates(journal);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment