Re: [PATCH v3 2/5] vfs: add xflags masks to fileattr API

From: Lauri Gates

Date: Tue Dec 01 2026 - 15:43:45 EST


On Mon, Nov 30, 2026 at 10:04 PM Amir Goldstein wrote:
> However, a filesystem can only report a new flag after it has opted
> into masks, so if a new flag requires converting many filesystems,
> it may not be realistic to maintain the freeze rule.

For writable flags the freeze rule may hold if a filesystem can set
has_masks without first giving every FS_*_FL flag an xflag. The
FS_IOC_SETFLAGS fallback from my first mail does that. With it, an
FS_IOC_SETFLAGS call that changes a flag with no xflag
(DIRSYNC, NOTAIL, ...) reaches the filesystem as the full
read-modify-write request it got before masks. Every other set call
becomes a masked request, as in v3. With the fallback, ocfs2 sets
has_masks with only its five xflags, and all six of its other
FS_IOC_SETFLAGS flags still set and clear.

A new writable flag then needs only the masked ->fileattr_set() of each
filesystem that adds it. That filesystem sees which flags the caller
named, so it can tell a change from a bit the VFS carried over, which a
get_only_masks filesystem, fed read-modify-write requests, cannot.

My last mail said get_only_masks lets the may-share series drop the
fallback. For read-only flags it does; for writable ones the fallback
still seems needed. Could v4 take the fallback alongside get_only_masks?
On top of your diff its condition becomes
"fs_has_masks && !(...)" in fileattr_set_convert().

With both applied and ocfs2 setting has_masks, not get_only_masks, all
my checks pass, including the six ocfs2 FS_IOC_SETFLAGS flags; without
the fallback those six fail with EOPNOTSUPP. Tree: v7.4-rc1, v3 1-3,
your diff (zero rw_mask returning -EINVAL as in your tree), the
mask_to_rmw line from my last mail, the fallback and the rest of the
may-share series; x86_64 under QEMU.

Thanks,
Lauri