Commit a2fd4ed8 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Luis Henriques

ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp

commit c45653c3 upstream.

Switch ext4 to using sb_getblk_gfp with GFP_NOFS added to fix possible
deadlocks in the page writeback path.
Signed-off-by: default avatarNikolay Borisov <kernel@kyup.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent cb1e4748
...@@ -487,7 +487,7 @@ __read_extent_tree_block(const char *function, unsigned int line, ...@@ -487,7 +487,7 @@ __read_extent_tree_block(const char *function, unsigned int line,
struct buffer_head *bh; struct buffer_head *bh;
int err; int err;
bh = sb_getblk(inode->i_sb, pblk); bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS);
if (unlikely(!bh)) if (unlikely(!bh))
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1061,7 +1061,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, ...@@ -1061,7 +1061,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
err = -EIO; err = -EIO;
goto cleanup; goto cleanup;
} }
bh = sb_getblk(inode->i_sb, newblock); bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS);
if (unlikely(!bh)) { if (unlikely(!bh)) {
err = -ENOMEM; err = -ENOMEM;
goto cleanup; goto cleanup;
...@@ -1247,7 +1247,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, ...@@ -1247,7 +1247,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
if (newblock == 0) if (newblock == 0)
return err; return err;
bh = sb_getblk(inode->i_sb, newblock); bh = sb_getblk_gfp(inode->i_sb, newblock, __GFP_MOVABLE | GFP_NOFS);
if (unlikely(!bh)) if (unlikely(!bh))
return -ENOMEM; return -ENOMEM;
lock_buffer(bh); lock_buffer(bh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment