zfsonlinux/zfs — pull request #2980 by behlendorf (2014-12-19 21:09:25+00:00)
Title: Fix zfs_putpage() lock inversion

There exists a lock inversions involving the zfs range lock and the
individual page writeback bits which can result in a deadlock. To
prevent this we must always manipulate the writeback bit while
holding the range lock. The exact deadlock is as follows:

------ Process A ------ ------ Process B ------
zpl_writepages zpl_fallocate
write_cache_pages zpl_fallocate_common
zpl_putpage zfs_space
zfs_putpage (set bit) zfs_freesp
zfs_range_lock (wait on lock) zfs_free_range (take lock)
truncate_inode_pages_range
wait_on_page_writeback (wait on bit)

Signed-off-by: Brian Behlendorf
Issue #2976