diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-09-18 17:12:02 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-09-18 17:12:02 -0400 |
commit | bb0445765866e5b1607af81e2f48ca5a8efbeed8 (patch) | |
tree | d21e6f656c82801e012b3c298691e72d9f8db370 /fs/ext4/super.c | |
parent | bda3253043c54a705c8352096194ab6216e2e5c1 (diff) |
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: Theodore Ts'o <tytso@mit.edu>
Reported-by: Dexuan Cui <decui@microsoft.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4770c98bdb61..4db537b3a162 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1131,6 +1131,8 @@ static const struct super_operations ext4_nojournal_sops = { | |||
1131 | .drop_inode = ext4_drop_inode, | 1131 | .drop_inode = ext4_drop_inode, |
1132 | .evict_inode = ext4_evict_inode, | 1132 | .evict_inode = ext4_evict_inode, |
1133 | .sync_fs = ext4_sync_fs, | 1133 | .sync_fs = ext4_sync_fs, |
1134 | .freeze_fs = ext4_freeze, | ||
1135 | .unfreeze_fs = ext4_unfreeze, | ||
1134 | .put_super = ext4_put_super, | 1136 | .put_super = ext4_put_super, |
1135 | .statfs = ext4_statfs, | 1137 | .statfs = ext4_statfs, |
1136 | .remount_fs = ext4_remount, | 1138 | .remount_fs = ext4_remount, |
@@ -4758,23 +4760,26 @@ static int ext4_freeze(struct super_block *sb) | |||
4758 | 4760 | ||
4759 | journal = EXT4_SB(sb)->s_journal; | 4761 | journal = EXT4_SB(sb)->s_journal; |
4760 | 4762 | ||
4761 | /* Now we set up the journal barrier. */ | 4763 | if (journal) { |
4762 | jbd2_journal_lock_updates(journal); | 4764 | /* Now we set up the journal barrier. */ |
4765 | jbd2_journal_lock_updates(journal); | ||
4763 | 4766 | ||
4764 | /* | 4767 | /* |
4765 | * Don't clear the needs_recovery flag if we failed to flush | 4768 | * Don't clear the needs_recovery flag if we failed to |
4766 | * the journal. | 4769 | * flush the journal. |
4767 | */ | 4770 | */ |
4768 | error = jbd2_journal_flush(journal); | 4771 | error = jbd2_journal_flush(journal); |
4769 | if (error < 0) | 4772 | if (error < 0) |
4770 | goto out; | 4773 | goto out; |
4774 | } | ||
4771 | 4775 | ||
4772 | /* Journal blocked and flushed, clear needs_recovery flag. */ | 4776 | /* Journal blocked and flushed, clear needs_recovery flag. */ |
4773 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 4777 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
4774 | error = ext4_commit_super(sb, 1); | 4778 | error = ext4_commit_super(sb, 1); |
4775 | out: | 4779 | out: |
4776 | /* we rely on upper layer to stop further updates */ | 4780 | if (journal) |
4777 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | 4781 | /* we rely on upper layer to stop further updates */ |
4782 | jbd2_journal_unlock_updates(journal); | ||
4778 | return error; | 4783 | return error; |
4779 | } | 4784 | } |
4780 | 4785 | ||