diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-02-02 15:21:27 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-02-03 11:34:24 +0100 |
commit | 5d04cec867365a4b5d76e327df4ef8b7ad1e89c2 (patch) | |
tree | 433bb48db448ccb5efdf5ba96331b6f023a113da | |
parent | be496d6a9b88d808ac009da311251fa25a62c39e (diff) | |
download | systemd-5d04cec867365a4b5d76e327df4ef8b7ad1e89c2.tar.gz |
journal: when copying journal file to undo NOCOW flag, go via fd
We have the journal file open already, hence reference it via the fd
insted of the file name. After all, some other tool might have
renamed/deleted it already.
Let's not actually reuse the fd though, since we want a separate file
offset for the copying, hence just make it simply and reopen via
/proc/self/fd/.
Follow-up for d71ece3f0b85c7a3decc50143b68ac07fc5831ae
-rw-r--r-- | src/journal/managed-journal-file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/journal/managed-journal-file.c b/src/journal/managed-journal-file.c index 8880329fa5..5b5555315d 100644 --- a/src/journal/managed-journal-file.c +++ b/src/journal/managed-journal-file.c @@ -192,7 +192,7 @@ 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(f->file->path, 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); if (r < 0) { log_debug_errno(r, "Failed to rewrite %s: %m", f->file->path); continue; |