[Pvfs2-developers] read buffer bug

Phil Carns pcarns at wastedcycles.org
Wed Nov 29 16:55:33 EST 2006


I ran into a problem today with the 2.6.0 release.  This happened to 
show up in the read04 LTP test, but not reliably.  I have attached a 
test program that I think does trigger it reliably, though.

When run on ext3:

	/home/pcarns> ./testme /tmp/foo.txt
	read returned: 7, test_buf: hello   world

When run on pvfs2:

	/home/pcarns> ./testme /mnt/pvfs2/foo.txt
	read returned: 7, test_buf: hello

(or sometimes you might get garbage after the "hello")

The test program creates a string buffer with "goodbye world" stored in 
it.  It then reads the string "hello  " out of a file into the beginning 
of that buffer.   The result should be that the final resulting string 
is "hello  world".

The trick that makes this fail is asking to read more than 7 bytes from 
the file.

In this particular test program, we attempt to do a read of 255 bytes. 
There are only 7 bytes in the file, though.  The return code from read 
accurately reflects this.  However, rather than just fill in the first 7 
bytes of the buffer, it looks like PVFS2 is overwriting the full 255 
bytes.  What ends up in those trailing 248 bytes is somewhat random.

I suspect that somewhere in the kernel module there is a copy_to_user() 
call that is copying the number of bytes requested by the read rather 
than the number of bytes returned by the servers.

-Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testme.c
Type: text/x-csrc
Size: 913 bytes
Desc: not available
Url : http://www.beowulf-underground.org/pipermail/pvfs2-developers/attachments/20061129/da3d8cea/testme.bin


More information about the Pvfs2-developers mailing list