can not delete a file that has been memory mapped until all dirty pages are written

view story

http://www.linuxquestions.org – Hi I am memory mapping files from java which wraps the mmap kernel function, it all works fine except that when I close my program down and try to delete the memomry mapped file the delete hangs for ages until all the dirty pages are written to the file. So If I am memory mapping a 25gb file, do a load of writes (resulting in loads of dirty memory pages that map to the file), close the program down then try to delete the file, the kernel will prevent the delete from happening until all 25gb of dirty pages are written to it, this causes any program using the drive to hang until it has finished. (HowTos)