On Mon Nov 30, 2026 at 8:44 PM CET, Lauri Gates wrote: > On Mon, Nov 30, 2026 at 07:43:54PM +0100, koraynilay wrote: >> Hi, can you try with this diff and setting both get_only_masks and >> has_masks to true in ocfs2's code? > > Tested. With your diff, FS_IOC_SETFLAGS sets and clears all six ocfs2 > flags again, so the may-share series can drop its VFS patch. > > One case broke: on a reflinked ocfs2 file, file_setattr() with > AT_FILEATTR_MASKS now fails with EOPNOTSUPP, setting or clearing > NOATIME. fileattr_set_mask_to_rmw() fills the unrequested xflags from > old_ma->fsx_xflags, which then include the read-only may-share bit. That > bit is not in FS_XFLAG_RDONLY_MASK, so it reaches ocfs2_fileattr_set(), > where fileattr_has_fsx() rejects the request. > > Could you fold something like this into v4? > > --- a/fs/file_attr.c > +++ b/fs/file_attr.c > @@ static int fileattr_set_mask_to_rmw(struct file_kattr *fa, > /* RMW filesystems expect to not have any globally read-only flag. */ > new_xflags &= ~FS_XFLAG_RDONLY_MASK; > + /* Nor xflags FS_IOC_FSSETXATTR lacks, e.g. MAYSHARE. */ > + new_xflags &= FS_XFLAGS_MASK | FS_XFLAG_PROJID; > > new_flags = xflags_to_flags(new_xflags); > > PROJID stays because the code below reads it before stripping it. Right, that can even be folded in the previous line when using the new FS_XFLAGS_FSXATTR_RW_MASK (or FS_XFLAGS_NOMASK_RW) by just clamping new_flags to that macro. We could actually also remove PROJID there, since the if below checks it against fa->fsx_xflags and not new_flags, but semantically it's not the best. > With that line added, all my checks pass on xfs, ocfs2, overlayfs > metacopy files and ext4. Tree: v7.4-rc1, v3 1-3, your diff (zero > rw_mask returning -EINVAL as in your tree), the may-share series > without its VFS patch; x86_64 under QEMU. Thanks, koraynilay > > Thanks, > Lauri