From: Franck Bui Date: Mon, 14 Mar 2022 17:03:02 +0000 (+0100) Subject: journal: preserve acls when rotating user journals with NOCOW attribute set X-Git-Tag: v251-rc1~150^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11ee11dbb34587edcde5020c5baf1402dcc4ffdf;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/journal/managed-journal-file.c b/src/journal/managed-journal-file.c index 657cf5ebbf6..03b1d8275e6 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;