daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
803fb7
From c730efd5335cf49ef78008b7d49fc5d5215089eb Mon Sep 17 00:00:00 2001
803fb7
From: Lennart Poettering <lennart@poettering.net>
803fb7
Date: Fri, 15 May 2015 20:56:55 +0200
803fb7
Subject: [PATCH] coredump: make sure we vacuum by default
803fb7
803fb7
Only if both keep_free and max_use are actually 0 we can shortcut things
803fb7
and avoid vacuuming. If either are positive or -1 we need to execute the
803fb7
vacuuming.
803fb7
803fb7
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html
803fb7
(cherry picked from commit 5470c03b37d8421a903564c2c8028c8b8d67d403)
803fb7
803fb7
Cherry-picked from: 5470c03
803fb7
Resolves: #1222517
803fb7
---
803fb7
 man/coredump.conf.xml         | 4 +++-
803fb7
 src/journal/coredump-vacuum.c | 5 ++---
803fb7
 2 files changed, 5 insertions(+), 4 deletions(-)
803fb7
803fb7
diff --git a/man/coredump.conf.xml b/man/coredump.conf.xml
803fb7
index 0b7329bf5..fd54c59e6 100644
803fb7
--- a/man/coredump.conf.xml
803fb7
+++ b/man/coredump.conf.xml
803fb7
@@ -134,7 +134,9 @@
803fb7
         by coredumps might temporarily exceed these limits while
803fb7
         coredumps are processed. Note that old coredumps are also
803fb7
         removed based on time via
803fb7
-        <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
803fb7
+        <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Set
803fb7
+        either value to 0 to turn off size based
803fb7
+        clean-up.</para></listitem>
803fb7
       </varlistentry>
803fb7
     </variablelist>
803fb7
 
803fb7
diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c
803fb7
index 9b73795e5..c0347ef56 100644
803fb7
--- a/src/journal/coredump-vacuum.c
803fb7
+++ b/src/journal/coredump-vacuum.c
803fb7
@@ -103,8 +103,7 @@ static bool vacuum_necessary(int fd, off_t sum, off_t keep_free, off_t max_use)
803fb7
 
803fb7
                         if (max_use < DEFAULT_MAX_USE_LOWER)
803fb7
                                 max_use = DEFAULT_MAX_USE_LOWER;
803fb7
-                }
803fb7
-                else
803fb7
+                } else
803fb7
                         max_use = DEFAULT_MAX_USE_LOWER;
803fb7
         } else
803fb7
                 max_use = PAGE_ALIGN(max_use);
803fb7
@@ -135,7 +134,7 @@ int coredump_vacuum(int exclude_fd, off_t keep_free, off_t max_use) {
803fb7
         struct stat exclude_st;
803fb7
         int r;
803fb7
 
803fb7
-        if (keep_free <= 0 && max_use <= 0)
803fb7
+        if (keep_free == 0 && max_use == 0)
803fb7
                 return 0;
803fb7
 
803fb7
         if (exclude_fd >= 0) {