Blame SOURCES/0029-o-rhv-Wait-for-the-NBD-server-to-exit-to-avoid-a-rac.patch

696189
From f820585c37beb648ab856818179091349a604523 Mon Sep 17 00:00:00 2001
696189
From: "Richard W.M. Jones" <rjones@redhat.com>
696189
Date: Fri, 15 Jul 2022 11:37:46 +0100
696189
Subject: [PATCH] -o rhv: Wait for the NBD server to exit to avoid a race with
696189
 unmounting
696189
696189
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1953286#c26
696189
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
696189
(cherry picked from commit 2fbd578b4e6884a23063ad67ee36f02c4eb6c668)
696189
---
696189
 output/output_rhv.ml | 9 ++++++++-
696189
 1 file changed, 8 insertions(+), 1 deletion(-)
696189
696189
diff --git a/output/output_rhv.ml b/output/output_rhv.ml
696189
index 15a2c14a..45f831e3 100644
696189
--- a/output/output_rhv.ml
696189
+++ b/output/output_rhv.ml
696189
@@ -175,7 +175,14 @@ module RHV = struct
696189
               chmod filename 0o666
696189
           )
696189
         in
696189
-        output_to_local_file ~changeuid
696189
+
696189
+        (* We have to wait for the NBD server to exit rather than just
696189
+         * killing it, otherwise it races with unmounting.  See:
696189
+         * https://bugzilla.redhat.com/show_bug.cgi?id=1953286#c26
696189
+         *)
696189
+        let on_exit_kill = Output.KillAndWait in
696189
+
696189
+        output_to_local_file ~changeuid ~on_exit_kill
696189
           output_alloc output_format filename size socket
696189
     ) (List.combine disks filenames);
696189