On 21/09/2020 16:44, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> > > iomap complete routine can deadlock with btrfs_fallocate because of the > call to generic_write_sync(). > > 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> > > inode_dio_end() is used to notify the end of DIO data in order > to synchronize with truncate. Call inode_dio_end() before calling > generic_write_sync(), so filesystems can lock i_rwsem during a sync. > > --- > fs/iomap/direct-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Missing S-o-b as well.