From: Darrick J. Wong Date: Tue, 12 Sep 2023 19:39:52 +0000 (-0700) Subject: libxfs: use XFS_IGET_CREATE when creating new files X-Git-Tag: v6.5.0~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f5bbe286e02b0c7df72aba386b56af92b812dc3;p=thirdparty%2Fxfsprogs-dev.git libxfs: use XFS_IGET_CREATE when creating new files 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 Reviewed-by: Carlos Maiolino Reviewed-by: Bill O'Donnell Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/util.c b/libxfs/util.c index e7d3497ec..8f79b0cd1 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -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);