Re: [PATCH] Fix vmtruncate race and distributed filesystem race
From: Andrew Morton <hidden>
Date: 2003-06-23 06:18:05
Also in:
lkml
From: Andrew Morton <hidden>
Date: 2003-06-23 06:18:05
Also in:
lkml
"Paul E. McKenney" [off-list ref] wrote:
quoted
but you can't trap this with a single counter increment in do_truncate:> > CPU 0 CPU 1 > ---------- ----------- > do_no_page > truncate
i_size = new_i_size;
> increment counter > read counter > ->nopage
check i_size
> vmtruncate > read counter again -> different so retry > > thanks to the second counter increment after vmtruncate in my fix, the > above race couldn't happen. The trick is that CPU 0 is expected to have updated the filesystem's idea of what pages are available before calling vmtruncate, invalidate_mmap_range() or whichever.
i_size has been updated, and filemap_nopage() will return NULL. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>