Skip to content

Add f*_xflags_{rw,ro}_mask flags to the fileattr API

koraynilay linux-api linux-btrfs linux-fsdevel linux-nfs linux-xfs lkml ntfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vfs: use goto out on error in vfs_fileattr_set()fs/file_attr.c+23 -220 replies
2/3vfs: add xflags mask to fileattr APIfs/file_attr.c include/linux/fileattr.h include/uapi/linux/fs.h+131 -110 replies
3/3ntfs: switch to the new xflags fileattr APIfs/file_attr.c fs/ntfs/file.c include/linux/fileattr.h +1 more+44 -350 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Add f*_xflags_{rw,ro}_mask flags to the fileattr API

This is a follow up patch series stemmed from [1] and [2], splitting the _mask change for the fileattr API into its own separate patch.

The first patch is a preparatory patch so that the code in the patch after can be formatted better.

The second patch is the actual implementation, which introduces:
- fa_xflags_{rw,ro}_mask fields to struct file_attr
- fsx_xflags_{rw,ro}_mask fields and has_masks selector to struct file_kattr

These masks have the following semantics:
- rw_mask:
* for filesystems: advertise which xflags they support changing
* for userspace: specify which xflags it wants to modify
- ro_mask:
* for filesystems: advertise which xflags they support only reading
* for userspace: ignored

(ro_mask for userspace was also proposed as a "verification mask"[3] but I left out that semantic to keep this patch series more contained, and can be added later if needed.)

This allows userspace to not have to do a RMW cycle when using the file_[gs]etattr() syscalls, avoiding possible race conditions and simplifying their usage.

Patch 2/3 also introduces the missing FS_XFLAG_PROJID flag so that programs like chattr can leverage the new mask API. FS_XFLAG_PROJID is kept out of the legacy FS_XFLAG_MASK and so it's defined as part of a new FS_FILE_ATTR_XFLAGS_MASK group of xflags that will be used moving forward for any new xflag (like the one proposed in [2]).

Patch 3/3 converts fs/ntfs to this new API, to show how it can benefit filesystem drivers too.

The series has been tested across NTFS, ext4 (with project quotas), XFS (project quotas and extent size hints), and Btrfs.

Thanks,
koraynilay

[1]: https://lore.kernel.org/CAOQ4uxg8aVcWyNiFDk8djdn-M3xJcu_7-kRxVq9jjFsbcGp1ew@mail.gmail.com/
[2]: https://lore.kernel.org/CAOQ4uxjVQ9cjV=_jBjQtNg9zCuWUEJT9KNYMKV+1jwBkHen5OA@mail.gmail.com/
[3]: https://lore.kernel.org/CAOQ4uxjCN-ekd18R-soD8tkGFnXjK0S1VdSNhq9b3Ev6y8K9jQ@mail.gmail.com/

koraynilay (3):
vfs: use goto out on error in vfs_fileattr_set()
vfs: add xflags mask to fileattr API
ntfs: switch to the new xflags fileattr API

 fs/file_attr.c           | 179 ++++++++++++++++++++++++++++++++-------
 fs/ntfs/file.c           |  63 +++++++-------
 include/linux/fileattr.h |  13 ++-
 include/uapi/linux/fs.h  |   9 +-
 4 files changed, 197 insertions(+), 67 deletions(-)

base-commit: 3857587d9d6fa44d40d1c73bde6a39f6f7a5216c
prerequisite-patch-id: 7af19117a27af492e3e525774310fb3a76700ffa

Signature · 1 line
2.56.0