lkml.org 
[lkml]   [2003]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix vmtruncate race and distributed filesystem race
"Paul E. McKenney" <paulmck@us.ibm.com> wrote:
>
> > 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.066 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site