homed: drop caches harder

echoing "2" is apparently not enough to erase inodes/dentrys from
memory, hence use "3", which seems to work.

Fixes: #32596
This commit is contained in:
Lennart Poettering
2024-05-30 14:50:40 +02:00
committed by Luca Boccassi
parent 381918edc9
commit 43ad199802
+2 -2
View File
@@ -300,10 +300,10 @@ static void drop_caches_now(void) {
int r;
/* Drop file system caches now. See https://docs.kernel.org/admin-guide/sysctl/vm.html
* for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
* for details. We write "3" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
* not more. */
r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
r = write_string_file("/proc/sys/vm/drop_caches", "3\n", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
else