On Tue, Oct 25, 2016 at 09:13:29AM -0800, Kent Overstreet wrote: > Also - what are you doing about the race between shooting down the range in the > pagecache and dirty pages being readded? The existing direct IO code falls back > to buffered IO for that, but your code doesn't appear to - I seem to recall that > XFS has its own locking for this, are you just relying on that for now? It'd be > really nice to get some generic locking for this, anything that relies on > pagecache invalidation is sketchy as hell in other filesystems. Yes, XFS always had a shared/exclusive lock for I/O operations, which is taken exclusive for buffered writes and those corner cases of direct writes that needs exclusіon (e.g. sub-fs block size I/O). This prevents new dirty pages from being added while direct I/O is in progress. There is nothing to prevent direct reads, though - that's why both the old common code, the old XFS code and this new code do a second invalidation after the write is done. Now that the VFS i_mutex has been replaced with i_rwsem we can apply this scheme to common code as well by taking i_rwsem shared for direct I/O reads. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html