From 47c0f3b8ae90885b937ecbd193f7803420c50a50 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 27 Sep 2025 19:40:32 +0200 Subject: [PATCH] Before spinning down flush all the disk caches --- cmdline/unix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmdline/unix.c b/cmdline/unix.c index 83eebbf3..7841fa71 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -1548,6 +1548,11 @@ int devquery(tommy_list* high, tommy_list* low, int operation, int others) { void* (*func)(void* arg) = 0; + if (operation == DEVICE_DOWN) { + /* flush all the disk caches before spinning down */ + sync(); + } + #if HAVE_LINUX_DEVICE tommy_node* i; struct stat st;