In the Linux kernel, the following vulnerability has been resolved:
ext4: avoid deadlock in fs reclaim with page writeback
Ext4 has a filesystem wide lock protecting ext4_writepages() calls to avoid races with switching of journalled data flag or inode format. This lock can however cause a deadlock like:
CPU0 CPU1
ext4writepages() percpudownread(sbi->swritepagesrwsem); ext4changeinodejournalflag() percpudownwrite(sbi->swritepagesrwsem); - blocks, all readers block from now on ext4dowritepages() ext4initioend() kmemcachezalloc(ioendcachep, GFPKERNEL) fsreclaim frees dentry... dentryunlinkinode() iput() - last ref => iputfinal() - inode dirty => writeinodenow()... ext4writepages() tries to acquire sbi->swritepagesrwsem and blocks forever
Make sure we cannot recurse into filesystem reclaim from writeback code to avoid the deadlock.