public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: make sure SB_I_VERSION doesn't get unset by remount
@ 2020-07-30 15:18 Josef Bacik
  2020-07-30 16:32 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2020-07-30 15:18 UTC (permalink / raw)
  To: linux-btrfs, kernel-team; +Cc: Eric Sandeen

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.

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/super.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 5bcdad3ee258..0a9d8b7664f7 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1960,6 +1960,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 		set_bit(BTRFS_FS_OPEN, &fs_info->flags);
 	}
 out:
+	/*
+	 * We need to set S_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);
 	btrfs_remount_cleanup(fs_info, old_opts);
 	clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: make sure SB_I_VERSION doesn't get unset by remount
  2020-07-30 15:18 [PATCH] btrfs: make sure SB_I_VERSION doesn't get unset by remount Josef Bacik
@ 2020-07-30 16:32 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-07-30 16:32 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs, kernel-team, Eric Sandeen

On Thu, Jul 30, 2020 at 11:18:09AM -0400, Josef Bacik wrote:
> 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.

Agreed. 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-30 16:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-30 15:18 [PATCH] btrfs: make sure SB_I_VERSION doesn't get unset by remount Josef Bacik
2020-07-30 16:32 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox