+ OLDNAME=$oldname_absolute
+
+ # In the future, the path2fid and fid2path calls below
+ # should be replaced with a single call to
+ # "lfs path2links" once that command is available. The logic
+ # for detecting unlisted hard links could then be removed.
+ local fid=$(lfs path2fid "$OLDNAME" 2> /dev/null)
+ if [ $? -ne 0 ]; then
+ echo -n "$OLDNAME: cannot determine FID; skipping; "
+ echo "is this a Lustre file system?"
+ continue
+ fi
+
+ if [[ ${nlink_type[0]} -gt 1 || $RSYNC_WITH_HLINKS == true ]]; then
+ # don't migrate a hard link if it was already migrated
+ if path_in_set "$OLDNAME"; then
+ $ECHO -e "$OLDNAME: already migrated via another hard link"
+ continue
+ fi
+
+ # There is limited space available in the xattrs
+ # to store all of the hard links for a file, so it's
+ # possible that $OLDNAME is part of a link set but is
+ # not listed in xattrs and therefore not listed as
+ # being migrated.
+ local migrated=$(old_fid_in_set "$fid")
+ if [ -n "$migrated" ]; then
+ $ECHO -e "$OLDNAME: already migrated via another hard link"
+ if [[ $LFS_MIGRATE_RSYNC == true ]]; then
+ # Only the rsync case has to relink.
+ # The lfs migrate case preserves the
+ # inode so the links are already
+ # correct.
+ [ "$migrated" != "$OLDNAME" ] &&
+ ln -f "$migrated" "$OLDNAME"
+ fi
+ add_to_set "$fid" "$OLDNAME"
+ continue;
+ fi
+ fi