30 lines
988 B
Diff
30 lines
988 B
Diff
From 0349d30afcf1d345c1b4f9090447a561c944c8e5 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Fri, 25 Apr 2025 15:24:43 +0100
|
|
Subject: [PATCH] daemon/fstrim.c: Issue sync_disks after fstrim
|
|
|
|
Thanks: Eric Sandeen
|
|
(cherry picked from commit e127edcafc95c75bf484bf2199eb746a392c58c0)
|
|
---
|
|
daemon/fstrim.c | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/daemon/fstrim.c b/daemon/fstrim.c
|
|
index f6869042..3928f8bb 100644
|
|
--- a/daemon/fstrim.c
|
|
+++ b/daemon/fstrim.c
|
|
@@ -116,5 +116,13 @@ do_fstrim (const char *path,
|
|
if (verbose)
|
|
fprintf (stderr, "%s\n", out);
|
|
|
|
+ /* Sync the disks again. In practice we always call fstrim
|
|
+ * expecting that afterwards the results are visible in the qemu
|
|
+ * devices backing the guest. Depending on the Linux filesystem,
|
|
+ * fstrim may issue asynch discard requests, so it's not necessarily
|
|
+ * true that everything has been written out before this point.
|
|
+ */
|
|
+ sync_disks ();
|
|
+
|
|
return 0;
|
|
}
|