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
+1 -2
View File
@@ -1205,8 +1205,7 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
case IMAGE_RAW:
new_path = strjoina("/var/lib/machines/", new_name, ".raw");
r = copy_file_atomic_full(i->path, new_path, read_only ? 0444 : 0644, FS_NOCOW_FL, FS_NOCOW_FL,
COPY_REFLINK|COPY_CRTIME, NULL, NULL);
r = copy_file_atomic(i->path, new_path, read_only ? 0444 : 0644, COPY_REFLINK|COPY_CRTIME);
break;
case IMAGE_BLOCK: