On Nov 15, 2013, at 10:25, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > On Fri, Nov 15, 2013 at 10:23:01AM -0500, Trond Myklebust wrote: >>> buffered read: shared >>> direct I/O exclusive if pagecache is present, then >>> demote to shared for actual I/O, >>> shared only if no pages are present on >>> the file >> >> I think we should try to close the truncate race first. Then let?s look at whether or not people need better consistency with the page cache. > > With the current locking model that will require the i_mutex in both > read and write around the i_dio_count increment. The XFS model avoids > taking an exclusive lock for the direct I/O fast path. OK, so afaics it is basically a wrapper around a 2 lock system: an rw_semaphore and the i_mutex. That means adding an rw_semaphore to the nfs_inode; we unfortunately cannot use the existing rw_sem since that is taken during lock recovery and so could deadlock if we take it during i/o.-- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html