mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Yifan Feng <evanfengff@gmail.com>, David Sterba <dsterba@suse.com>
Cc: Chris Mason <mason@kernel.org>,
	Josef Bacik <josef@toxicpanda.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Christian Brauner <brauner@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: don't drop noacl on a remount without acl or noacl
Date: Wed, 2 Dec 2026 14:01:44 +1030	[thread overview]
Message-ID: <0694a7cc-cf2e-41f1-bd5e-4dbbda284178@suse.com> (raw)
In-Reply-To: <20261202002243.72027-1-evanfengff@gmail.com>



在 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


      reply	other threads:[~2026-12-02  3:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  0:22 Yifan Feng
2026-12-02  3:31 ` Qu Wenruo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0694a7cc-cf2e-41f1-bd5e-4dbbda284178@suse.com \
    --to=wqu@suse.com \
    --cc=brauner@kernel.org \
    --cc=dsterba@suse.com \
    --cc=evanfengff@gmail.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®