ocfs2: Fix deadlock when allocating page
We cannot call grab_cache_page() when holding filesystem locks or with a transaction started as grab_cache_page() calls page allocation with GFP_KERNEL flag and thus page reclaim can recurse back into the filesystem causing deadlocks or various assertion failures. We have to use find_or_create_page() instead and pass it GFP_NOFS as we do with other allocations. Acked-by: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Tao Ma <tao.ma@oracle.com>
This commit is contained in:
@@ -783,7 +783,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
||||
BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT));
|
||||
BUG_ON(abs_from & (inode->i_blkbits - 1));
|
||||
|
||||
page = grab_cache_page(mapping, index);
|
||||
page = find_or_create_page(mapping, index, GFP_NOFS);
|
||||
if (!page) {
|
||||
ret = -ENOMEM;
|
||||
mlog_errno(ret);
|
||||
|
Reference in New Issue
Block a user