struct xfs_trans *tp;
struct xfs_parent_args *ppargs = NULL;
- tp = getres(mp, 0);
- ppargs = newpptr(mp);
- dst_ino = get_hardlink_dst_inode(file_stat.st_ino);
-
/*
* We didn't find the hardlink inode, this means it's the first time
* we see it, report error so create_nondir_inode() can continue handling the
* inode as a regular file type, and later save the source inode in our
* buffer for future consumption.
*/
+ dst_ino = get_hardlink_dst_inode(file_stat.st_ino);
if (dst_ino == 0)
return false;
+ tp = getres(mp, 0);
+ ppargs = newpptr(mp);
+
error = -libxfs_iget(mp, NULL, dst_ino, 0, &ip);
if (error)
fail(_("failed to get inode"), error);
close(fd);
return;
}
- /*
- * If instead we have an error it means the hardlink was not registered,
- * so we proceed to treat it like a regular file, and save it to our
- * tracker later.
- */
- tp = getres(mp, 0);
+
/*
* In case of symlinks, we need to handle things a little differently.
* We need to read out our link target and act accordingly.
if (link_len >= PATH_MAX)
fail(_("symlink target too long"), ENAMETOOLONG);
tp = getres(mp, XFS_B_TO_FSB(mp, link_len));
+ } else {
+ tp = getres(mp, 0);
}
ppargs = newpptr(mp);