pull: honor sync for OCI artifacts
Synchronize OCI layer directories and generated metadata when IMPORT_SYNC is enabled, matching the raw and tar pull paths. Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
366fa466d2
commit
d8c1f1d105
+13
-4
@@ -1067,7 +1067,9 @@ static int oci_pull_save_nspawn_settings(OciPull *i) {
|
||||
fprintf(f, "Parameters=%s\n", ej);
|
||||
}
|
||||
|
||||
r = flink_tmpfile(f, tmpfile, j, LINK_TMPFILE_REPLACE);
|
||||
r = flink_tmpfile(f, tmpfile, j,
|
||||
LINK_TMPFILE_REPLACE|
|
||||
(i->flags & IMPORT_SYNC ? LINK_TMPFILE_SYNC : 0));
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to move '%s' into place: %m", j);
|
||||
|
||||
@@ -1099,7 +1101,9 @@ static int oci_pull_save_oci_config(OciPull *i) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write '%s': %m", j);
|
||||
|
||||
r = link_tmpfile(fd, tmpfile, j, LINK_TMPFILE_REPLACE);
|
||||
r = link_tmpfile(fd, tmpfile, j,
|
||||
LINK_TMPFILE_REPLACE|
|
||||
(i->flags & IMPORT_SYNC ? LINK_TMPFILE_SYNC : 0));
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to move '%s' into place: %m", j);
|
||||
|
||||
@@ -1174,8 +1178,13 @@ static int oci_pull_save_mstack(OciPull *i) {
|
||||
}
|
||||
}
|
||||
|
||||
if (rename(jt, j) < 0)
|
||||
return log_error_errno(errno, "Failed to move '%s' into place: %m", j);
|
||||
r = install_file(
|
||||
AT_FDCWD, jt,
|
||||
AT_FDCWD, j,
|
||||
(i->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
|
||||
(i->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to move '%s' into place: %m", j);
|
||||
|
||||
jt = mfree(jt); /* Disarm rm_rf_physical_and_free() */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user