78c8600f66
Add upstream patch to fix one of the tests that fails on slow machines.
53 lines
2.2 KiB
Diff
53 lines
2.2 KiB
Diff
From 0475bfe04a527051c0a37af59a733c4c8554e427 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Fri, 17 Apr 2020 22:23:56 +0100
|
|
Subject: [PATCH] ocaml: Fix bug in asynch copy test.
|
|
|
|
This program had a subtle bug: If we've read everything from the
|
|
source, but there are still source commands in flight, AND it happens
|
|
that there are no destination commands in flight, then the loop
|
|
finishes prematurely. This is particularly evident when you run the
|
|
test on a slow machine (armv7 in Koji is illustrative). The fix is to
|
|
check that there are no commands in flight either from the source or
|
|
to the destination.
|
|
|
|
(I actually discovered this when writing the golang bindings which
|
|
copied from the OCaml version, but forgot to make the correction to
|
|
the original.)
|
|
---
|
|
ocaml/examples/asynch_copy.ml | 3 ++-
|
|
ocaml/tests/test_590_aio_copy.ml | 3 ++-
|
|
2 files changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml
|
|
index d5dcc60..7132f57 100644
|
|
--- a/ocaml/examples/asynch_copy.ml
|
|
+++ b/ocaml/examples/asynch_copy.ml
|
|
@@ -41,7 +41,8 @@ let asynch_copy src dst =
|
|
(* The main loop which runs until we have finished reading and
|
|
* there are no more commands in flight.
|
|
*)
|
|
- while !soff < size || NBD.aio_in_flight dst > 0 do
|
|
+ while !soff < size || NBD.aio_in_flight src > 0 || NBD.aio_in_flight dst > 0
|
|
+ do
|
|
(* If we're able to submit more reads from the source then do so now. *)
|
|
if !soff < size && NBD.aio_in_flight src < max_reads_in_flight then (
|
|
let bs = min bs (size -^ !soff) in
|
|
diff --git a/ocaml/tests/test_590_aio_copy.ml b/ocaml/tests/test_590_aio_copy.ml
|
|
index ac490ef..e3cd59d 100644
|
|
--- a/ocaml/tests/test_590_aio_copy.ml
|
|
+++ b/ocaml/tests/test_590_aio_copy.ml
|
|
@@ -64,7 +64,8 @@ let asynch_copy src dst =
|
|
(* The main loop which runs until we have finished reading and
|
|
* there are no more commands in flight.
|
|
*)
|
|
- while !soff < size || NBD.aio_in_flight dst > 0 do
|
|
+ while !soff < size || NBD.aio_in_flight src > 0 || NBD.aio_in_flight dst > 0
|
|
+ do
|
|
(* If we're able to submit more reads from the source then do so now. *)
|
|
if !soff < size && NBD.aio_in_flight src < max_reads_in_flight then (
|
|
let bs = min bs (size -^ !soff) in
|
|
--
|
|
2.25.0
|
|
|