[systemd-devel] [PATCH] ignore keep_free when creating a new journal
George McCollister
george.mccollister at gmail.com
Fri Apr 26 08:22:23 PDT 2013
keep_free should be ignored when creating a new journal, otherwise
server_rotate() will fail to setup the new journal if keep_free is exceed
and server_vacuum will not be able to reclaim space.
There might be more ellegant solutions to this problem but this works in my
tests and it's a simple change.
Signed-off-by: George McCollister <george.mccollister at gmail.com>
---
src/journal/journal-file.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index a44e126..f720d0b 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2351,6 +2351,7 @@ int journal_file_open(
JournalFile *f;
int r;
bool newly_created = false;
+ uint64_t save_keep_free;
assert(fname);
assert(ret);
@@ -2491,6 +2492,11 @@ int journal_file_open(
goto fail;
}
+ if (newly_created) {
+ save_keep_free = f->metrics.keep_free;
+ f->metrics.keep_free = 0;
+ }
+
#ifdef HAVE_GCRYPT
r = journal_file_hmac_setup(f);
if (r < 0)
@@ -2521,6 +2527,9 @@ int journal_file_open(
if (r < 0)
goto fail;
+ if (newly_created)
+ f->metrics.keep_free = save_keep_free;
+
*ret = f;
return 0;
--
1.8.2.1
More information about the systemd-devel
mailing list