]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs: when creating a file in a directory, set the project id based on the parent
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Jan 2024 17:39:35 +0000 (09:39 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 10 Apr 2024 00:21:33 +0000 (17:21 -0700)
When we're creating a file as a child of an existing directory, use
xfs_get_initial_prid to have the child inherit the project id of the
directory if the directory has PROJINHERIT set, just like the kernel
does.  This fixes mkfs project id propagation with -d projinherit=X when
protofiles are in use.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/inode.c
libxfs/libxfs_api_defs.h

index f3766b849fa9d8fc06c3aca55c32cd18adb75e8d..148c232fb6e47362f3d8495ee14674a4aa550aba 100644 (file)
@@ -263,6 +263,7 @@ libxfs_dir_ialloc(
                .pip            = dp,
                .uid            = make_kuid(cr->cr_uid),
                .gid            = make_kgid(cr->cr_gid),
+               .prid           = dp ? libxfs_get_initial_prid(dp) : 0,
                .nlink          = nlink,
                .rdev           = rdev,
                .mode           = mode,
index d75bc23cc4c2a91665fe344ca8a8948950367c03..bcf562741d9943ed1ff7fe897c894e89b01f326a 100644 (file)
 #define xfs_free_perag                 libxfs_free_perag
 #define xfs_fs_geometry                        libxfs_fs_geometry
 #define xfs_get_projid                 libxfs_get_projid
+#define xfs_get_initial_prid           libxfs_get_initial_prid
 #define xfs_highbit32                  libxfs_highbit32
 #define xfs_highbit64                  libxfs_highbit64
 #define xfs_ialloc_calc_rootino                libxfs_ialloc_calc_rootino