Commit faa00889 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: make sure SB_I_VERSION doesn't get unset by remount

There's some inconsistency around SB_I_VERSION handling with mount and
remount.  Since we don't really want it to be off ever just work around
this by making sure we don't get the flag cleared on remount.

There's a tiny cpu cost of setting the bit, otherwise all changes to
i_version also change some of the times (ctime/mtime) so the inode needs
to be synced. We wouldn't save anything by disabling it.
Reported-by: default avatarEric Sandeen <sandeen@redhat.com>
CC: stable@vger.kernel.org # 5.4+
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ add perf impact analysis ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4f26433e
...@@ -1960,6 +1960,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1960,6 +1960,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
set_bit(BTRFS_FS_OPEN, &fs_info->flags); set_bit(BTRFS_FS_OPEN, &fs_info->flags);
} }
out: out:
/*
* We need to set SB_I_VERSION here otherwise it'll get cleared by VFS,
* since the absence of the flag means it can be toggled off by remount.
*/
*flags |= SB_I_VERSION;
wake_up_process(fs_info->transaction_kthread); wake_up_process(fs_info->transaction_kthread);
btrfs_remount_cleanup(fs_info, old_opts); btrfs_remount_cleanup(fs_info, old_opts);
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
......
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