]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: use XFS_IGET_CREATE when creating new files
authorDarrick J. Wong <djwong@kernel.org>
Tue, 12 Sep 2023 19:39:52 +0000 (12:39 -0700)
committerCarlos Maiolino <cem@kernel.org>
Thu, 5 Oct 2023 12:57:20 +0000 (14:57 +0200)
Use this flag to check that newly allocated inodes are, in fact,
unallocated.  This matches the kernel, and prevents userspace programs
from making latent corruptions worse by unintentionally crosslinking
files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/util.c

index e7d3497ec96ff81c3ab53b8e953b069fd0b8dc24..8f79b0cd17b7b648b5c2c0bb2506553d30d31957 100644 (file)
@@ -260,7 +260,7 @@ libxfs_init_new_inode(
        unsigned int            flags;
        int                     error;
 
-       error = libxfs_iget(tp->t_mountp, tp, ino, 0, &ip);
+       error = libxfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, &ip);
        if (error != 0)
                return error;
        ASSERT(ip != NULL);