On Thu Nov 19, 2026 at 8:36 PM CET, Amir Goldstein wrote: > On Sun, Nov 15, 2026 at 7:04 PM koraynilay wrote: >> >> Add fileattr_has_fsx_mask() as a helper to let filesystems check for >> unsupported xflags while allowing supported ones. Can be used in the >> same way as fileattr_has_fsx(). >> >> Also make fileattr_has_fsx() a wrapper around fileattr_has_fsx_mask(). >> >> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.4.7 >> Signed-off-by: koraynilay >> --- >> include/linux/fileattr.h | 21 ++++++++++++++++++--- >> 1 file changed, 18 insertions(+), 3 deletions(-) >> >> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h >> index 42b92ccdc583..ba7ed3b387d8 100644 >> --- a/include/linux/fileattr.h >> +++ b/include/linux/fileattr.h >> @@ -65,6 +65,23 @@ int copy_fsxattr_to_user(const struct file_kattr *fa, struct fsxattr __user *ufa >> void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags); >> void fileattr_fill_flags(struct file_kattr *fa, u32 flags); >> >> +/** >> + * fileattr_has_fsx_mask - check for extended flags/attributes >> + * @fa: fileattr pointer >> + * @allowed_xflags_mask: additional xflags permitted >> + * >> + * Return: true if any attributes are present that are not represented in >> + * ->flags or @allowed_xflags_mask. >> + */ >> +static inline bool fileattr_has_fsx_mask(const struct file_kattr *fa, >> + u32 allowed_xflags_mask) >> +{ >> + return fa->fsx_valid && >> + ((fa->fsx_xflags & ~(FS_XFLAG_COMMON | allowed_xflags_mask)) || >> + fa->fsx_extsize != 0 || fa->fsx_projid != 0 || >> + fa->fsx_cowextsize != 0); >> +} >> + > > Every patch in your series did: > > if (fileattr_has_fsx_mask(fa, EXFAT_SUPPORTED_XFLAGS)) > return -EOPNOTSUPP; > > if (fa->fsx_xflags_mask & ~EXFAT_SUPPORTED_XFLAGS) > return -EOPNOTSUPP; > > It looks like this helper is not as helpful as it could have been > and you have raised this question yourself in the cover letter. > > Effectively every filesystem that supports fileattr_set() already has > a defined SUPPORTED mask, so I think it's better to do the negated > something like: > > static inline bool fileattr_supported_fsx_mask(const struct file_kattr *fa, > u32 supported) > { > if (!fa->fsx_valid) > return true; > if ((fa->fsx_xflags | fa->fsx_xflags_mask) & ~supported) > return false; > if (fa->fsx_extsize && > !(supported & (FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT))) > return false; > if (fa->fsx_cowextsize && !(supported & FS_XFLAG_COWEXTSIZE)) > return false; > if (fa->fsx_projid && !(supported & FS_XFLAG_PROJID)) > return false; > return true; > } > > > ... > > if (!fileattr_supported_fsx_mask(fa, EXFAT_SUPPORTED_XFLAGS)) > return -EOPNOTSUPP; > > >> /** >> * fileattr_has_fsx - check for extended flags/attributes >> * @fa: fileattr pointer >> @@ -74,9 +91,7 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags); >> */ >> static inline bool fileattr_has_fsx(const struct file_kattr *fa) >> { >> - return fa->fsx_valid && >> - ((fa->fsx_xflags & ~FS_XFLAG_COMMON) || fa->fsx_extsize != 0 || >> - fa->fsx_projid != 0 || fa->fsx_cowextsize != 0); >> + return fileattr_has_fsx_mask(fa, 0); > > return !fileattr_supported_fsx_mask(fa, FS_XFLAG_COMMON); > > I hope I got this right. I think so yeah, though for me it's easier to think about it as "unsupported" instead of "supported", but the idea should be correct. Though yeah, this helper may not even be needed, I'll see if it's better to keep it and write it like you did here, or just remove it altogether and just do & ~SUPPORTED. Thanks, koraynilay > Thanks, > Amir.