summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-12-20 16:01:57 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-01 14:11:07 +0100
commitadc6f43b148b097c846f63522876f0f1c91ea0c0 (patch)
tree36f3310a1216afdea22c35bc91751bc8618f598a /src/import
parent2bef2582a140e4dbaa517c16befc445919f9b7c6 (diff)
downloadsystemd-adc6f43b148b097c846f63522876f0f1c91ea0c0.tar.gz
copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly requested
Previously, when we'd copy an individual file we'd synthesize a user.crtime_usec xattr with the source's creation time if we can determine it. As the creation/birth time was until recently not queriable form userspace this effectively just propagated the same xattr on the source to the same xattr on the destination. However, current kernels now allow to query the birthtime using statx() and we do make use of that now. Which means that suddenly we started synthesizing these xattrs much more regularly. Doing this actually does make sense, but only in very few cases: not for the typical regular files we copy, but certainly when dealing with disk images. Hence, let's keep this kind of propagation, but let's make it a flag and default to off. Then turn it on whenever we deal with disk images, and leave it off otherwise. This is particularly relevant as overlayfs combining a real fs, and a tmpfs on top will result in EOPNOTSUPP when it is attempted to open a file with xattrs for writing, as tmpfs does not support xattrs, and hence the copy-up cannot work. Hence, let's avoid synthesizing this needlessly, to increase compat with overlayfs.
Diffstat (limited to 'src/import')
-rw-r--r--src/import/export-raw.c2
-rw-r--r--src/import/import-raw.c2
-rw-r--r--src/import/pull-raw.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/import/export-raw.c b/src/import/export-raw.c
index 6a02b47a17..c1c946cd2b 100644
--- a/src/import/export-raw.c
+++ b/src/import/export-raw.c
@@ -223,7 +223,7 @@ static int raw_export_process(RawExport *e) {
finish:
if (r >= 0) {
- (void) copy_times(e->input_fd, e->output_fd);
+ (void) copy_times(e->input_fd, e->output_fd, COPY_CRTIME);
(void) copy_xattr(e->input_fd, e->output_fd);
}
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 4b1161557d..56f3431a08 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -215,7 +215,7 @@ static int raw_import_finish(RawImport *i) {
return r;
if (S_ISREG(i->st.st_mode)) {
- (void) copy_times(i->input_fd, i->output_fd);
+ (void) copy_times(i->input_fd, i->output_fd, COPY_CRTIME);
(void) copy_xattr(i->input_fd, i->output_fd);
}
diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c
index 3a3e015df8..72b9054e49 100644
--- a/src/import/pull-raw.c
+++ b/src/import/pull-raw.c
@@ -368,7 +368,7 @@ static int raw_pull_make_local_copy(RawPull *i) {
return log_error_errno(r, "Failed to make writable copy of image: %m");
}
- (void) copy_times(i->raw_job->disk_fd, dfd);
+ (void) copy_times(i->raw_job->disk_fd, dfd, COPY_CRTIME);
(void) copy_xattr(i->raw_job->disk_fd, dfd);
dfd = safe_close(dfd);