From: "koraynilay" <koray.fra@gmail.com>
To: "Luis Henriques" <luis@igalia.com>, "koraynilay" <koray.fra@gmail.com>
Cc: "Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Jan Kara" <jack@suse.cz>, "Edward Adam Davis" <eadavis@qq.com>,
"Amir Goldstein" <amir73il@gmail.com>,
"Miklos Szeredi" <miklos@szeredi.hu>,
<linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] vfs: fix file_getattr hint to request xflags
Date: Tue, 24 Nov 2026 17:36:57 +0100 [thread overview]
Message-ID: <DN3L6DY60QKG.184FB9CISL5SL@gmail.com> (raw)
In-Reply-To: <87se0qb42p.fsf@igalia.com>
[-- Attachment #1: Type: text/plain, Size: 3066 bytes --]
On Tue Nov 24, 2026 at 5:13 PM CET, Luis Henriques wrote:
> On Tue, Nov 24 2026, koraynilay wrote:
>
>> When using a FUSE mount over an underlying filesystem that supports
>> xflags, querying them from userspace with file_getattr() strips them
>> because file_getattr sets flags_valid = true so FUSE uses
>> FS_IOC_GETFLAGS instead of FS_IOC_FSGETXATTR.
>>
>> Fix it by setting fsx_valid = true instead.
>>
>> Output when using a simple FUSE mount that simply forwards the ioctls to
>> the underlying fs:
>>
>> before the fix:
>>
>> /xfs/file: FS_IOC_FSGETXATTR: ret=0, projid=69
>> /xfs/file: file_getattr: ret=0, projid=0
>> /ext4/file: FS_IOC_FSGETXATTR: ret=0, projid=42
>> /ext4/file: file_getattr: ret=0, projid=0
>>
>> after the fix:
>>
>> /xfs/file: FS_IOC_FSGETXATTR: ret=0, projid=69
>> /xfs/file: file_getattr: ret=0, projid=69
>> /ext4/file: FS_IOC_FSGETXATTR: ret=0, projid=42
>> /ext4/file: file_getattr: ret=0, projid=42
>>
>> Fixes: cb184dd19154 ("fs: init flags_valid before calling vfs_fileattr_get")
>> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.11
>> Signed-off-by: koraynilay <koray.fra@gmail.com>
>> ---
>> Hi, I found this issue while working on the v2 of [1], here is the
>> reproducer, not in the commit message because of the size.
[...]
>>
>> [1]: https://lore.kernel.org/all/DN2YMTH77KWE.3IPE9OG8377X0@gmail.com/T/#t
>>
>> fs/file_attr.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/file_attr.c b/fs/file_attr.c
>> index 833e03810b24..3b249a0a6b36 100644
>> --- a/fs/file_attr.c
>> +++ b/fs/file_attr.c
>> @@ -383,7 +383,7 @@ SYSCALL_DEFINE5(file_getattr, int, dfd, const char __user *, filename,
>> struct path filepath __free(path_put) = {};
>> unsigned int lookup_flags = 0;
>> struct file_attr fattr;
>> - struct file_kattr fa = { .flags_valid = true }; /* hint only */
>> + struct file_kattr fa = { .fsx_valid = true }; /* hint only */
>
> Isn't this reintroducing the bug that was fixed by commit
>
> cb184dd19154 ("fs: init flags_valid before calling vfs_fileattr_get") ?
Hmm, it shouldn't, since that was just an uninitialized bug for the
whole struct, while now it's initialized (unless you meant something
else?).
> Maybe fuse_fileattr_get() shouldn't be handling FS_IOC_FSGETXATTR at all,
> and FS_IOC_FSGETXATTR handling should be moved into fuse_do_ioctl()
> instead? (Or, more likely, I'm missing something!)
The bug being fixed is when using file_getattr tho, which in the vfs is
directly sent to inode->i_op->fileattr_get(dentry, fa), which for FUSE
is fuse_fileattr_get().
What should probably be done though (well, not in this patch) is switch
fuse_fileattr_get() from FS_IOC_FSGETXATTR to vfs_fileattr_get(), for
fsx_valid.
This is because while right now FS_IOC_FSGETXATTR is equivalent to
file_getattr VER0, in the [1] above it will be bumped to VER1, making
file_getattr VER1 a superset of file_getattr VER0.
Thanks,
koraynilay
> Cheers,
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-24 16:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 15:01 [PATCH] vfs: fix file_getattr hint to request xflags koraynilay
2026-11-24 15:36 ` Amir Goldstein
2026-11-24 16:00 ` Jan Kara
2026-11-24 16:13 ` Luis Henriques
2026-11-24 16:36 ` koraynilay [this message]
2026-11-24 17:04 ` Luis Henriques
2026-12-01 13:07 ` Christian Brauner
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=DN3L6DY60QKG.184FB9CISL5SL@gmail.com \
--to=koray.fra@gmail.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=eadavis@qq.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luis@igalia.com \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.