tree-wide: Don't explicity disable copy-on-write when copying images

Since the copy helpers now copy file attributes as well, let's not
explicitly disable copy-on-write anymore when we copy an image. If
the source already has copy-on-write disabled, the copy will have it
disabled as well. Otherwise, the copy will also have copy-on-write
enabled.

This makes sure that reflinks always work as reflink is only supported
if both source and target are copy-on-write or both source and target
are not copy-on-write.
This commit is contained in:
Daan De Meyer
2024-07-25 11:56:07 +02:00
parent 2356104efc
commit 42e9288180
3 changed files with 3 additions and 16 deletions
+2 -4
View File
@@ -6072,10 +6072,8 @@ static int run(int argc, char *argv[]) {
{
BLOCK_SIGNALS(SIGINT);
r = copy_file_full(arg_image, np, O_EXCL, arg_read_only ? 0400 : 0600,
FS_NOCOW_FL, FS_NOCOW_FL,
COPY_REFLINK|COPY_CRTIME|COPY_SIGINT,
NULL, NULL);
r = copy_file(arg_image, np, O_EXCL, arg_read_only ? 0400 : 0600,
COPY_REFLINK|COPY_CRTIME|COPY_SIGINT);
}
if (r == -EINTR) {
log_error_errno(r, "Interrupted while copying image file to %s, removed again.", np);