Enable writing after the 2G boundary

This patch fixes a bug in readwrite.c which truncated the 'from' field
in nbd requests.  It was casting them down from an off64_t to an int.
This commit is contained in:
Alex Young
2012-07-12 18:01:10 +01:00
parent cef2dcaad2
commit 2e4e592c08
6 changed files with 55 additions and 19 deletions

View File

@@ -79,6 +79,10 @@ class Environment
end
def truncate1( size )
system "truncate -s #{size} #{@filename1}"
end
def listening_ports
`netstat -ltn`.

View File

@@ -81,4 +81,15 @@ class TestHappyPath < Test::Unit::TestCase
assert @env.status2['has_control'], "destination didn't take control"
end
def test_write_to_high_block
# Create a large file, then try to write to somewhere after the 2G boundary
@env.truncate1 "4G"
@env.serve1
@env.nbd1.write( 2**31+2**29, "12345678" )
sleep(1)
assert_equal "12345678", @env.nbd1.read( 2**31+2**29, 8 )
end
end