I/O error during writeback of mmaped file

Viewed 44

Is there any standard (POSIX etc) OS behaviour for handling errors during mmap writeback? Is this even documented somewhere as stable implementation?

Case 1: Some program doing mmap(), writing to that memory area, and doing munmap() or msync(MS_SYNC). In this case, there is explicit place where writeback errors could be reported, but I don't know if they should be reported at munmap()/msync() by any standard.

Case 2: Some program doing mmap(), writing to that memory area, and doing sleep(1000). Writeback should be done asynchronously by the OS, but now there is no explicit place to report any errors from writeback. However, OS can send SIGBUS to the program. Again, I don't know if this standardized.

Case 3: Two programs (A and B) doing mmap(MAP_SHARED) for the same file. Program A writes something to that memory, program B should instantly see this changes and may rely on them. After some time, OS getting error while trying to writeback. Now the only reasonable behaviour I see it to kill both processes because they rely on changes that can't be made. But this looks weird.

0 Answers
Related