ext4: move unlocked dio protection from ext4_alloc_file_blocks()
authorJan Kara <jack@suse.com>
Mon, 7 Dec 2015 19:29:17 +0000 (14:29 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 7 Dec 2015 19:29:17 +0000 (14:29 -0500)
commit17048e8a083fec7ad841d88ef0812707fbc7e39f
treea5f6ac206edfbe5807e6f9834d6dfe663e9b31c6
parentea3d7209ca01da209cda6f0dea8be9cc4b7a933b
ext4: move unlocked dio protection from ext4_alloc_file_blocks()

Currently ext4_alloc_file_blocks() was handling protection against
unlocked DIO. However we now need to sometimes call it under i_mmap_sem
and sometimes not and DIO protection ranks above it (although strictly
speaking this cannot currently create any deadlocks). Also
ext4_zero_range() was actually getting & releasing unlocked DIO
protection twice in some cases. Luckily it didn't introduce any real bug
but it was a land mine waiting to be stepped on.  So move DIO protection
out from ext4_alloc_file_blocks() into the two callsites.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c