ext4: prevent fsreentrance deadlock for inline_data

ext4_da_convert_inline_data_to_extent() invokes
grab_cache_page_write_begin().  grab_cache_page_write_begin performs
memory allocation, so fs-reentrance should be prohibited because we
are inside journal transaction.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Dmitry Monakhov 2014-12-02 16:09:50 -05:00 committed by Theodore Ts'o
parent d4f7610743
commit 5cc28a9eaa

View File

@ -870,6 +870,12 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
goto out_journal;
}
/*
* We cannot recurse into the filesystem as the transaction
* is already started.
*/
flags |= AOP_FLAG_NOFS;
if (ret == -ENOSPC) {
ret = ext4_da_convert_inline_data_to_extent(mapping,
inode,
@ -882,11 +888,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
goto out;
}
/*
* We cannot recurse into the filesystem as the transaction
* is already started.
*/
flags |= AOP_FLAG_NOFS;
page = grab_cache_page_write_begin(mapping, 0, flags);
if (!page) {