tree-wide: copy hardlinks wherever we deal with possibly large OS-style trees
Fixes: #7382
This commit is contained in:
parent
dd480f7835
commit
652d90407a
|
@ -1654,7 +1654,10 @@ int btrfs_subvol_snapshot_fd_full(
|
|||
} else if (r < 0)
|
||||
return r;
|
||||
|
||||
r = copy_directory_fd_full(old_fd, new_path, COPY_MERGE|COPY_REFLINK|COPY_SAME_MOUNT|(FLAGS_SET(flags, BTRFS_SNAPSHOT_SIGINT) ? COPY_SIGINT : 0), progress_path, progress_bytes, userdata);
|
||||
r = copy_directory_fd_full(
|
||||
old_fd, new_path,
|
||||
COPY_MERGE|COPY_REFLINK|COPY_SAME_MOUNT|COPY_HARDLINKS|(FLAGS_SET(flags, BTRFS_SNAPSHOT_SIGINT) ? COPY_SIGINT : 0),
|
||||
progress_path, progress_bytes, userdata);
|
||||
if (r < 0)
|
||||
goto fallback_fail;
|
||||
|
||||
|
|
|
@ -1066,7 +1066,7 @@ finish:
|
|||
int bus_machine_method_copy(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
const char *src, *dest, *host_path, *container_path, *host_basename, *container_basename, *container_dirname;
|
||||
_cleanup_close_pair_ int errno_pipe_fd[2] = { -1, -1 };
|
||||
CopyFlags copy_flags = COPY_REFLINK|COPY_MERGE;
|
||||
CopyFlags copy_flags = COPY_REFLINK|COPY_MERGE|COPY_HARDLINKS;
|
||||
_cleanup_close_ int hostfd = -1;
|
||||
Machine *m = userdata;
|
||||
bool copy_from;
|
||||
|
|
|
@ -2609,9 +2609,17 @@ static int do_copy_files(Partition *p, const char *fs) {
|
|||
if (pfd < 0)
|
||||
return log_error_errno(pfd, "Failed to open parent directory of target: %m");
|
||||
|
||||
r = copy_tree_at(sfd, ".", pfd, basename(*target), UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_MERGE|COPY_REPLACE|COPY_SIGINT);
|
||||
r = copy_tree_at(
|
||||
sfd, ".",
|
||||
pfd, basename(*target),
|
||||
UID_INVALID, GID_INVALID,
|
||||
COPY_REFLINK|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS);
|
||||
} else
|
||||
r = copy_tree_at(sfd, ".", tfd, ".", UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_MERGE|COPY_REPLACE|COPY_SIGINT);
|
||||
r = copy_tree_at(
|
||||
sfd, ".",
|
||||
tfd, ".",
|
||||
UID_INVALID, GID_INVALID,
|
||||
COPY_REFLINK|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to copy %s%s to %s: %m", strempty(arg_root), *source, *target);
|
||||
} else {
|
||||
|
|
|
@ -1540,7 +1540,7 @@ static int copy_files(Item *i) {
|
|||
dfd, bn,
|
||||
i->uid_set ? i->uid : UID_INVALID,
|
||||
i->gid_set ? i->gid : GID_INVALID,
|
||||
COPY_REFLINK | COPY_MERGE_EMPTY | COPY_MAC_CREATE);
|
||||
COPY_REFLINK | COPY_MERGE_EMPTY | COPY_MAC_CREATE | COPY_HARDLINKS);
|
||||
if (r < 0) {
|
||||
struct stat a, b;
|
||||
|
||||
|
|
Loading…
Reference in a new issue