Re: [stable] [PATCH 25/25] generic_file_buffered_write(): deadlock on vectored write

Chris Wright
2006-06-29T18:26:08Z

* Chris Wright (chrisw@sous-sol.org) wrote:
> From: Vladimir V. Saveliev <vs@namesys.com>
>
> generic_file_buffered_write() prefaults in user pages in order to avoid
> deadlock on copying from the same page as write goes to.
>
> However, it looks like there is a problem when write is vectored:
> fault_in_pages_readable brings in current segment or its part (maxlen).
> OTOH, filemap_copy_from_user_iovec is called to copy number of bytes
> (bytes) which may exceed current segment, so filemap_copy_from_user_iovec
> switches to the next segment which is not brought in yet. Pagefault is
> generated. That causes the deadlock if pagefault is for the same page
> write goes to: page being written is locked and not uptodate, pagefault
> will deadlock trying to lock locked page.

This is dropped for now, as it causes another problem with 0 length
iovecs. Andrew has written a fix and once it's baked in Linus' tree for
a bit we can take back this one plus the fix.

thanks,
-chris