[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xg3perwgtxrm37begxk6fll5zt43p6zuebvsfyj3hqjhozlokt@5xjc7thn7eaq>
Date: Thu, 22 Jan 2026 10:40:35 +0100
From: Jan Kara <jack@...e.cz>
To: Andrey Albershteyn <aalbersh@...nel.org>
Cc: brauner@...nel.org, jack@...e.cz, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Eric Biggers <ebiggers@...nel.org>
Subject: Re: [PATCH] fs: reset read-only fsflags together with xflags
On Wed 21-01-26 20:36:43, Andrey Albershteyn wrote:
> While setting file attributes, the read-only flags are reset
> for ->xflags, but not for ->flags if flag is shared between both. This
> is fine for now as all read-only xflags don't overlap with flags.
> However, for any read-only shared flag this will create inconsistency
> between xflags and flags. The non-shared flag will be reset in
> vfs_fileattr_set() to the current value, but shared one is past further
^^ passed
> to ->fileattr_set.
>
> Reported-by: Eric Biggers <ebiggers@...nel.org>
> Signed-off-by: Andrey Albershteyn <aalbersh@...nel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
>
> The shared read-only flag is going to be added for fsverity. The one for ->flags
> already exists.
>
> [1]: https://lore.kernel.org/linux-xfs/20260119165644.2945008-2-aalbersh@kernel.org/
>
> ---
> fs/file_attr.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/file_attr.c b/fs/file_attr.c
> index 13cdb31a3e94..bed5442fa6fa 100644
> --- a/fs/file_attr.c
> +++ b/fs/file_attr.c
> @@ -142,8 +142,7 @@ static int file_attr_to_fileattr(const struct file_attr *fattr,
> if (fattr->fa_xflags & ~mask)
> return -EINVAL;
>
> - fileattr_fill_xflags(fa, fattr->fa_xflags);
> - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
> + fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
> fa->fsx_extsize = fattr->fa_extsize;
> fa->fsx_projid = fattr->fa_projid;
> fa->fsx_cowextsize = fattr->fa_cowextsize;
> @@ -163,8 +162,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
> if (xfa.fsx_xflags & ~mask)
> return -EOPNOTSUPP;
>
> - fileattr_fill_xflags(fa, xfa.fsx_xflags);
> - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
> + fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
> fa->fsx_extsize = xfa.fsx_extsize;
> fa->fsx_nextents = xfa.fsx_nextents;
> fa->fsx_projid = xfa.fsx_projid;
> --
> 2.52.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists