[Pvfs2-developers] read buffer bug
Phil Carns
pcarns at wastedcycles.org
Thu Nov 30 11:15:04 EST 2006
Thanks for the quick fix!
Murali Vilayannur wrote:
> Hi guys,
> I am really sorry about this. I am surprised we did not catch this
> earlier. This was basically introduced by the file.c/bufmap.c cleanups
> that I had done a while back.
> Attached patch should fix this error.
> thanks for the testcase, Phil!
> Murali
>
> On 11/29/06, Phil Carns <pcarns at wastedcycles.org> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> Pvfs2-developers mailing list
>> Pvfs2-developers at beowulf-underground.org
>> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>>
>>
>>
>>
More information about the Pvfs2-developers
mailing list