Hello, Recently I had a look at how io_ends are handled for AIO DIO. When doing AIO DIO we allocate io_end and attach it to inode. ext4_ext_map_blocks() then fetches io_end from inode and operates on it. This scheme is somewhat fragile because it relies on the fact that we hold i_mutex whenever we need io_end which is non-obvious dependency (if it was not for io_end handling, i_data_sem would be enough). dioread_nolock mode broke this assumption and was corrupting io_end pointers until recently which somewhat demostrates my point. This patch set converts ext4 to allocate io_end only once we spot unwritten extent during direct IO write and uses bh->b_private and dio->private to store it in the same fashion as XFS. That way passing of io_end pointer happens via IO-local context and is thus independent of any locks. The core of the change is in patch 5/6, the rest are related cleanups and preparations for the change. Patches pass xfstests in normal and dioread_nolock mode. Patch 5/6 conflicts with changes of DIO completion on error however resolving these conflicts should be straightforward. Honza -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html