* [PATCH] btrfs: don't drop noacl on a remount without acl or noacl
@ 2026-12-02 0:22 Yifan Feng
2026-12-02 3:31 ` Qu Wenruo
0 siblings, 1 reply; 2+ messages in thread
From: Yifan Feng @ 2026-12-02 0:22 UTC (permalink / raw)
To: David Sterba
Cc: Chris Mason, Josef Bacik, Johannes Thumshirn, Christian Brauner,
linux-btrfs, linux-kernel, Yifan Feng
btrfs_init_fs_context() sets SB_POSIXACL in every new context, and
btrfs_reconfigure() applies the flag when it differs from the mounted
one. So a remount that names neither acl nor noacl switches a noacl
mount back to ACLs, and the ACLs stored on the files are enforced
again:
# mount -o noacl /dev/vda /mnt
# findmnt -no OPTIONS /mnt
rw,relatime,discard=async,noacl,space_cache=v2,subvolid=5,subvol=/
# mount -o remount,noatime /dev/vda /mnt
# findmnt -no OPTIONS /mnt
rw,noatime,discard=async,space_cache=v2,subvolid=5,subvol=/
mount(8) hides this when it is given the mount point only, because it
then passes the current options again. Before the conversion to the
mount API the flag changed only when one of the two options was given.
For a remount, set the flag only if the mounted filesystem has it.
Fixes: ad21f15b0f79 ("btrfs: switch to the new mount API")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
Tested in QEMU with mount(2), mount(8) from util-linux 2.38.1 and fspick()/fsconfig(). fstests -g quick plus 71 acl and remount tests give the same results with and without the patch (BTRFS_DEBUG, btrfs-progs 6.2).
Found and written with the help of an AI coding assistant.
fs/btrfs/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index b424cc836bd4..2770ad797a21 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2204,7 +2204,10 @@ static int btrfs_init_fs_context(struct fs_context *fc)
}
#ifdef CONFIG_BTRFS_FS_POSIX_ACL
- fc->sb_flags |= SB_POSIXACL;
+ /* A remount without acl or noacl keeps what is in use. */
+ if (fc->purpose != FS_CONTEXT_FOR_RECONFIGURE ||
+ (fc->root->d_sb->s_flags & SB_POSIXACL))
+ fc->sb_flags |= SB_POSIXACL;
#endif
fc->sb_flags |= SB_I_VERSION;
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.39.3 (Apple Git-146)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: don't drop noacl on a remount without acl or noacl
2026-12-02 0:22 [PATCH] btrfs: don't drop noacl on a remount without acl or noacl Yifan Feng
@ 2026-12-02 3:31 ` Qu Wenruo
0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2026-12-02 3:31 UTC (permalink / raw)
To: Yifan Feng, David Sterba
Cc: Chris Mason, Josef Bacik, Johannes Thumshirn, Christian Brauner,
linux-btrfs, linux-kernel
在 2026/12/2 10:52, Yifan Feng 写道:
> btrfs_init_fs_context() sets SB_POSIXACL in every new context, and
> btrfs_reconfigure() applies the flag when it differs from the mounted
> one. So a remount that names neither acl nor noacl switches a noacl
> mount back to ACLs, and the ACLs stored on the files are enforced
> again:
>
> # mount -o noacl /dev/vda /mnt
> # findmnt -no OPTIONS /mnt
> rw,relatime,discard=async,noacl,space_cache=v2,subvolid=5,subvol=/
> # mount -o remount,noatime /dev/vda /mnt
> # findmnt -no OPTIONS /mnt
> rw,noatime,discard=async,space_cache=v2,subvolid=5,subvol=/
>
> mount(8) hides this when it is given the mount point only, because it
> then passes the current options again. Before the conversion to the
> mount API the flag changed only when one of the two options was given.
>
> For a remount, set the flag only if the mounted filesystem has it.
>
> Fixes: ad21f15b0f79 ("btrfs: switch to the new mount API")
> Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Will push to for-next soon.
> ---
> Tested in QEMU with mount(2), mount(8) from util-linux 2.38.1 and fspick()/fsconfig(). fstests -g quick plus 71 acl and remount tests give the same results with and without the patch (BTRFS_DEBUG, btrfs-progs 6.2).
> Found and written with the help of an AI coding assistant.
>
> fs/btrfs/super.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index b424cc836bd4..2770ad797a21 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -2204,7 +2204,10 @@ static int btrfs_init_fs_context(struct fs_context *fc)
> }
>
> #ifdef CONFIG_BTRFS_FS_POSIX_ACL
> - fc->sb_flags |= SB_POSIXACL;
> + /* A remount without acl or noacl keeps what is in use. */
> + if (fc->purpose != FS_CONTEXT_FOR_RECONFIGURE ||
> + (fc->root->d_sb->s_flags & SB_POSIXACL))
> + fc->sb_flags |= SB_POSIXACL;
> #endif
> fc->sb_flags |= SB_I_VERSION;
>
>
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 3:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 0:22 [PATCH] btrfs: don't drop noacl on a remount without acl or noacl Yifan Feng
2026-12-02 3:31 ` Qu Wenruo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®