Subject: Re: Data corruption with dump (mmap related??)
To: Wayne Knowles <w.knowles@niwa.cri.nz>
From: Chris G. Demetriou <cgd@sibyte.com>
List: port-mips
Date: 08/25/2000 09:39:43
w.knowles@niwa.cri.nz (Wayne Knowles) writes:
> I'm pretty confident it is mmap related as the following patch to dump
> which fills the mmap'ed region to 255 also changes the 0 to 255 in the
> corrupted region:

i think i disagree with your diagnosis.

you mmap it and fill it (or it's zero-filled by mmap), and that's
pretty much where the involvement of mmap() ends.  it's just a mapped
writable region of your address space then, with contents, like your
heap and your program data segment.

the fact that you've filled it the a value and that value 'sticks'
means that the subsequent actions on the buffer, e.g. read(), aren't
filling the buffer properly, or the writes from the buffer aren't
copying the data correctly to the file.

Personally, i'd suspect copyin and/or copyout.  I'd guess a boundary
condition error -- note that all the errors you mentioned (unless i
goofed my calculation) hit the last few bytes of a block before an 2K
byte boundary.  2K is BLKDEV_IOSIZE, on most (all?) ports, though that
may just be a red herring...


one thing you might do is create a bunch of files of random data,
which contain no words which are all zero, and check after reading.



chris