On Thu, Sep 03, 2020 at 06:32:36PM +0200, Christoph Hellwig wrote: > We could trivially do something like this to allow the file system > to call iomap_dio_complete without i_rwsem: That just exposes another deadlock vector: P0 P1 inode_lock() fallocate(FALLOC_FL_ZERO_RANGE) __iomap_dio_rw() inode_lock() <block> <submits IO> <completes IO> inode_unlock() <gets inode_lock()> inode_dio_wait() iomap_dio_complete() generic_write_sync() btrfs_file_fsync() inode_lock() <deadlock> Basically, the only safe thing to do is implement ->fsync without holding the DIO IO submission lock.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx