Re: [PATCH 4/4] xfs: add XFS_IOC_SETFSXATTRAT and XFS_IOC_GETFSXATTRAT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 09, 2024 at 05:15:00PM +0200, Andrey Albershteyn wrote:
> XFS has project quotas which could be attached to a directory. All
> new inodes in these directories inherit project ID.
> 
> The project is created from userspace by opening and calling
> FS_IOC_FSSETXATTR on each inode. This is not possible for special
> files such as FIFO, SOCK, BLK etc. as opening them return special
> inode from VFS. Therefore, some inodes are left with empty project
> ID.
> 
> This patch adds new XFS ioctl which allows userspace, such as
> xfs_quota, to set project ID on special files. This will let
> xfs_quota set ID on all inodes and also reset it when project is
> removed.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@xxxxxxxxxx>

This really should be a VFS layer file ioctl (like
FS_IOC_FSSETXATTR). Path resolution needs to be done before we call
into the destination filesystem as the path may cross mount points
and take us outside the filesytem that the parent dir points to.

IOWs, there should be no need to change anything in XFS to support
FS_IOC_[GS]ETFSXATTRAT() as once the path has been resolved to a
dentry at the VFS we can just call the existing
vfs_fileattr_get()/vfs_fileattr_set() functions to get/set the
xattr.

The changes to allow/deny setting attributes on special files
then goes into fileattr_set_prepare(), and with that I don't think
there's much that needs changing in XFS at all...

-Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux