Skip to content

Commit

Permalink
btrfs: allocate btrfs_io_context without GFP_NOFAIL
Browse files Browse the repository at this point in the history
The __GFP_NOFAIL flag could loop indefinitely when allocation memory in
alloc_btrfs_io_context. The callers starting from __btrfs_map_block
already handle errors so it's safe to drop the flag.

Signed-off-by: Li zeming <zeming@nfschina.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Li zeming authored and David Sterba committed Dec 5, 2022
1 parent cb3e217 commit 9f0eac0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5899,7 +5899,10 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
* and the stripes.
*/
sizeof(u64) * (total_stripes),
GFP_NOFS|__GFP_NOFAIL);
GFP_NOFS);

if (!bioc)
return NULL;

refcount_set(&bioc->refs, 1);

Expand Down

0 comments on commit 9f0eac0

Please sign in to comment.