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

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