Re: Race between vmtruncate and mapped areas?

Andrew Morton
2003-05-14T01:10:22Z

Dave McCracken <dmccr@us.ibm.com> wrote:
>
> Actually it does fix it. I added code in vmtruncate_list() to do a
> down_write(&vma->vm_mm->mmap_sem) around the zap_page_range(), and the
> problem went away. It serializes against any outstanding page faults on a
> particular page table. New faults will see that the page is no longer in
> the file and fail with SIGBUS. Andrew's test case stopped failing.
>
> I've attached the patch so you can see what I did.
>
> Can anyone think of any gotchas to this solution?

mmap_sem nests outside i_shared_sem.