So Ilooked into the "unlocked" direct I/O case, and I think the current code using dio_sem is really sketchy. What btrfs really needs to do is take i_rwsem shared by default for direct writes, and only upgrade to the exclusive lock when needed, similar to xfs and the WIP ext4 code. While looking for that I also noticed two other things: - check_direct_IO looks pretty bogus - btrfs_direct_IO really should be split and folded into the two callers Untested patches attached. The first should probably go into a prep patch, and the second could be folded into this one.