]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: always use new_diflags2 to initialize new inodes
authorDarrick J. Wong <djwong@kernel.org>
Tue, 12 Jul 2022 18:30:33 +0000 (13:30 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 12 Jul 2022 18:30:33 +0000 (13:30 -0500)
The new_diflags2 field that's set in the inode geometry represent
features that we want enabled for /all/ newly created inodes.
Unfortunately, mkfs doesn't do that because xfs_flags2diflags2 doesn't
read new_diflags2.  Change the new_diflags2 logic to match the kernel.

Without this fix, the root directory gets created without the
DIFLAG2_NREXT64 iflag set, but files created by a protofile /do/ have it
turned on.

This wasn't an issue with DIFLAG2_BIGTIME because xfs_trans_log_inode
quietly turns that on whenever possible.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/util.c

index d2389198ca47033b8b7321ca0dbed774e30731dc..5d2383e9960bca0d1632537ae7bf080f23b6527a 100644 (file)
@@ -286,8 +286,10 @@ libxfs_init_new_inode(
 
        if (xfs_has_v3inodes(ip->i_mount)) {
                VFS_I(ip)->i_version = 1;
-               ip->i_diflags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 :
-                               xfs_flags2diflags2(ip, fsx->fsx_xflags);
+               ip->i_diflags2 = ip->i_mount->m_ino_geo.new_diflags2;
+               if (!pip)
+                       ip->i_diflags2 = xfs_flags2diflags2(ip,
+                                                       fsx->fsx_xflags);
                ip->i_crtime = VFS_I(ip)->i_mtime; /* struct copy */
                ip->i_cowextsize = pip ? 0 : fsx->fsx_cowextsize;
        }