tux3: Support mmap write: Fix race of mmap write with truncate(2)
mmap write and truncate(2) can race on delta boundary.
delta-1 = get_delta();
delta-2 = get_delta();
page-B = pagefork(page-A);
If mmap write and truncate(2) ran by above order, truncate(2) see
dirty page for delta-2. We should guarantee one doesn't see data in
To avoid this race, this introduces ->truncate_lock. And protects mmap
write while truncate(2) is running.
FIXME: This race would be rare cases in real usage though, more fine
granulate lock would be better.
Signed-off-by: OGAWA Hirofumi <email@example.com>
4 files changed