Re: infinite loop? with mmap, nfs, pwrite, O_DIRECT

From: Trond Myklebust
Date: Mon Nov 21 2005 - 18:58:12 EST

On Mon, 2005-11-21 at 15:34 -0800, Andrew Morton wrote:
> Trond Myklebust <trond.myklebust@xxxxxxxxxx> wrote:
> >
> > Anything that calls lock_page() should be avoided in O_DIRECT,
> Why?
> And it's still doing lock_page():
> nfs_file_direct_write()
> ->filemap_fdatawrite()
> ->do_writepages()
> ->nfs_writepages()
> ->generic_writepages()
> ->mpage_writepages()
> ->lock_page()


> > however
> > we should be able to call invalidate_inode_pages() since that doesn't
> > wait on the page lock.
> invalidate_inode_pages2() is better.

> And using generic_file_direct_IO() is
> better still, since it handles mmap coherency and only work upon that part
> of the file which is actually undergoing IO.

Unlike local filesystems, we don't want to have to take the i_sem in any
of the direct IO paths. The latter is just a liability as far as
applications are concerned: it doesn't offer any protection for local
data (there _is_ no local data to protect), but gets seriously in the
way of write parallelism.

The only difference I can see between the two paths is the call to
unmap_mapping_range(). What effect would that have?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at