some files written via mmap end up corrupted

Dan Nelson dnelson at allantgroup.com
Tue Nov 22 07:46:30 GMT 2005


In the last episode (Nov 21), Mikhail Teterin said:
> I must not be using the API properly :-(
> 
> The writes to the mmap-ed area and then fsync-s the opened file,
> munmaps it, and exits.
> 
> Sometimes, the files end up corrupted at the end, however -- in about
> 10% of cases.

What kind of corruption are you seeing?  Blocks of zeroes?  Maybe you
need to call msync() before unmapping the region?  Or call munmap
before fsync.
 
> What am I doing wrong? Thanks!

Can't tell that for sure without seeing the code :)

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list