From d75316c9072d9e10602eae4d4fe248d451fec533 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 19 Sep 2017 15:07:30 -0400 Subject: [PATCH] lib/commit: Don't try to call linkat() for import on distinct devices 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. Closes: #1193 Approved by: jlebon --- src/libostree/ostree-repo-commit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 6d770dea..e8bb2395 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -3189,8 +3189,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)