valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0205-coredump-make-sure-we-vacuum-by-default.patch

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