chiark / gitweb /
journal: take KeepFree into account when reporting maximum size
[elogind.git] / src / journal / journald-server.c
index b717b92ffb51a1d4c61372af95bd0c15b2f76217..0bf557c809e3dbc056e24a0a5db330d04fdc6c63 100644 (file)
@@ -227,9 +227,11 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
                 }
         }
 
-        /* We do not recalculate the mask here, so that the fchmod() mask above stays intact. */
+        /* We do not recalculate the mask unconditionally here,
+         * so that the fchmod() mask above stays intact. */
         if (acl_get_permset(entry, &permset) < 0 ||
-            acl_add_perm(permset, ACL_READ) < 0) {
+            acl_add_perm(permset, ACL_READ) < 0 ||
+            calc_acl_mask_if_needed(&acl) < 0) {
                 log_warning("Failed to patch ACL on %s, ignoring: %m", f->path);
                 goto finish;
         }
@@ -778,6 +780,9 @@ static int system_journal_open(Server *s) {
         char *fn;
         sd_id128_t machine;
         char ids[33];
+        uint64_t avail;
+
+        avail = available_space(s);
 
         r = sd_id128_get_machine(&machine);
         if (r < 0)
@@ -819,6 +824,10 @@ static int system_journal_open(Server *s) {
                         server_driver_message(s, SD_ID128_NULL, "Allowing system journal files to grow to %s.",
                                               format_bytes(fb, sizeof(fb), s->system_metrics.max_use));
 
+                        if (s->system_metrics.max_use > avail)
+                               server_driver_message(s, SD_ID128_NULL, "Journal size currently limited to %s due to SystemKeepFree.",
+                                                     format_bytes(fb, sizeof(fb), avail));
+
                 } else if (r < 0) {
 
                         if (r != -ENOENT && r != -EROFS)
@@ -872,6 +881,10 @@ static int system_journal_open(Server *s) {
                         server_fix_perms(s, s->runtime_journal, 0);
                         server_driver_message(s, SD_ID128_NULL, "Allowing runtime journal files to grow to %s.",
                                               format_bytes(fb, sizeof(fb), s->runtime_metrics.max_use));
+
+                        if (s->system_metrics.max_use > avail)
+                               server_driver_message(s, SD_ID128_NULL, "Journal size currently limited to %s due to RuntimeKeepFree.",
+                                                     format_bytes(fb, sizeof(fb), avail));
                 }
         }