Skip to content

Commit faa0088

Browse files
josefbacikkdave
authored andcommitted
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: Eric Sandeen <[email protected]> CC: [email protected] # 5.4+ Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> [ add perf impact analysis ] Signed-off-by: David Sterba <[email protected]>
1 parent 4f26433 commit faa0088

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/btrfs/super.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
19601960
set_bit(BTRFS_FS_OPEN, &fs_info->flags);
19611961
}
19621962
out:
1963+
/*
1964+
* We need to set SB_I_VERSION here otherwise it'll get cleared by VFS,
1965+
* since the absence of the flag means it can be toggled off by remount.
1966+
*/
1967+
*flags |= SB_I_VERSION;
1968+
19631969
wake_up_process(fs_info->transaction_kthread);
19641970
btrfs_remount_cleanup(fs_info, old_opts);
19651971
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);

0 commit comments

Comments
 (0)