From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Ensure that we propagate the bigtime inode flag correctly when creating new inodes. There critical part here is to use the new_diflags2 field in the incore geometry just like we do in the kernel. We also modify xfs_flags2diflags2 to have the same behavior as the kernel. This isn't strictly needed here, but we aim to avoid letting userspace diverge from the kernel function when we can. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- libxfs/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libxfs/util.c b/libxfs/util.c index c78074a01dab..252cf91e851b 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -197,7 +197,8 @@ xfs_flags2diflags2( unsigned int xflags) { uint64_t di_flags2 = - (ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK); + (ip->i_d.di_flags2 & (XFS_DIFLAG2_REFLINK | + XFS_DIFLAG2_BIGTIME)); if (xflags & FS_XFLAG_DAX) di_flags2 |= XFS_DIFLAG2_DAX; @@ -307,8 +308,8 @@ libxfs_ialloc( ASSERT(ip->i_d.di_ino == ino); ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid)); VFS_I(ip)->i_version = 1; - ip->i_d.di_flags2 = pip ? 0 : xfs_flags2diflags2(ip, - fsx->fsx_xflags); + ip->i_d.di_flags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 : + xfs_flags2diflags2(ip, fsx->fsx_xflags); ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec; ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec; ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize;