diff options
author | Franck Bui <fbui@suse.com> | 2022-03-14 18:03:02 +0100 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2022-03-14 18:03:02 +0100 |
commit | 11ee11dbb34587edcde5020c5baf1402dcc4ffdf (patch) | |
tree | 13018141dd725e816c6c2124bfa50389999b7f0c /src/journal/managed-journal-file.c | |
parent | 43c893e73e461dd2df6fddbbd1808bb178adf833 (diff) | |
download | systemd-11ee11dbb34587edcde5020c5baf1402dcc4ffdf.tar.gz |
journal: preserve acls when rotating user journals with NOCOW attribute set
When restoring the COW flag for journals on BTRFS, the full journal contents
are copied into new files. But during these operations, the acls of the
previous files were lost and users were not able to access to their old
journal contents anymore.
Diffstat (limited to 'src/journal/managed-journal-file.c')
-rw-r--r-- | src/journal/managed-journal-file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/journal/managed-journal-file.c b/src/journal/managed-journal-file.c index 657cf5ebbf..03b1d8275e 100644 --- a/src/journal/managed-journal-file.c +++ b/src/journal/managed-journal-file.c @@ -210,7 +210,10 @@ static void managed_journal_file_set_offline_internal(ManagedJournalFile *f) { log_debug_errno(r, "Failed to re-enable copy-on-write for %s: %m, rewriting file", f->file->path); - r = copy_file_atomic(FORMAT_PROC_FD_PATH(f->file->fd), f->file->path, f->file->mode, 0, FS_NOCOW_FL, COPY_REPLACE | COPY_FSYNC | COPY_HOLES); + r = copy_file_atomic(FORMAT_PROC_FD_PATH(f->file->fd), f->file->path, f->file->mode, + 0, + FS_NOCOW_FL, + COPY_REPLACE | COPY_FSYNC | COPY_HOLES | COPY_ALL_XATTRS); if (r < 0) { log_debug_errno(r, "Failed to rewrite %s: %m", f->file->path); continue; |