From e724d83bec0ec2a51455870cbd4fcf02fed7cdfb Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 11 Sep 2012 15:37:13 +0100 Subject: [PATCH 1/2] Ensure fiemap ioctl calls are synchronous. --- src/ioutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ioutil.c b/src/ioutil.c index bae5f54..7982e4d 100644 --- a/src/ioutil.c +++ b/src/ioutil.c @@ -21,7 +21,7 @@ struct bitset_mapping* build_allocation_map(int fd, uint64_t size, int resolutio fiemap_count->fm_start = 0; fiemap_count->fm_length = size; - fiemap_count->fm_flags = 0; + fiemap_count->fm_flags = FIEMAP_FLAG_SYNC; fiemap_count->fm_extent_count = 0; fiemap_count->fm_mapped_extents = 0; From ee652a29654b97ea5e16cba8af40d16c717228c9 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 11 Sep 2012 16:21:35 +0100 Subject: [PATCH 2/2] Fix some races in the acceptance tests --- tests/acceptance/test_happy_path.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/test_happy_path.rb b/tests/acceptance/test_happy_path.rb index 0c1db07..c93a770 100644 --- a/tests/acceptance/test_happy_path.rb +++ b/tests/acceptance/test_happy_path.rb @@ -74,10 +74,10 @@ class TestHappyPath < Test::Unit::TestCase def test_mirror - setup_to_mirror() - @env.nbd1.can_die @env.nbd2.can_die(0) + setup_to_mirror() + stdout, stderr = @env.mirror12 @env.nbd1.join @@ -91,14 +91,16 @@ class TestHappyPath < Test::Unit::TestCase def test_mirror_unlink + @env.nbd1.can_die(0) + @env.nbd2.can_die(0) setup_to_mirror() + assert File.file?( @env.filename1 ) stdout, stderr = @env.mirror12_unlink assert_no_match( /unrecognized/, stderr ) - @env.nbd1.can_die(0) - @env.nbd2.can_die(0) + Timeout.timeout(2) do @env.nbd1.join end @@ -128,3 +130,4 @@ class TestHappyPath < Test::Unit::TestCase end end +