Skip to content

Commit

Permalink
lib/commit: Don't try to call linkat() for import on distinct devices
Browse files Browse the repository at this point in the history
While opening a repo we've recorded the device/inode for a while; use it to
avoid calling `linkat()` during object import if we know it's going to fail.
  • Loading branch information
cgwalters committed Sep 20, 2017
1 parent 044e304 commit c9454f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libostree/ostree-repo-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3185,8 +3185,9 @@ import_via_hardlink_is_possible (OstreeRepo *src_repo,
OstreeRepo *dest_repo,
OstreeObjectType objtype)
{
/* We need the ability to make hardlinks */
if (src_repo->owner_uid != dest_repo->owner_uid)
/* hardlinks require the owner to match and to be on the same device */
if (!(src_repo->owner_uid == dest_repo->owner_uid &&
src_repo->device == dest_repo->device))
return FALSE;
/* Equal modes are always compatible */
if (src_repo->mode == dest_repo->mode)
Expand Down

0 comments on commit c9454f2

Please sign in to comment.