Skip to content

Commit 2bf96b5

Browse files
rajeevtapadiakdave
authored andcommitted
btrfs: fix comment in alloc_bitmap() and drop stale TODO
All callers of alloc_bitmap() hold a transaction handle, so GFP_NOFS is needed to avoid deadlocks on recursion. Update the comment and drop the stale TODO. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Rajeev Tapadia <rtapadia730@gmail.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 634bea7 commit 2bf96b5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/btrfs/free-space-tree.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,9 @@ static unsigned long *alloc_bitmap(u32 bitmap_size)
165165

166166
/*
167167
* GFP_NOFS doesn't work with kvmalloc(), but we really can't recurse
168-
* into the filesystem as the free space bitmap can be modified in the
169-
* critical section of a transaction commit.
170-
*
171-
* TODO: push the memalloc_nofs_{save,restore}() to the caller where we
172-
* know that recursion is unsafe.
168+
* into the filesystem here. All callers hold a transaction handle
169+
* open, so if a GFP_KERNEL allocation recurses into the filesystem
170+
* and triggers a transaction commit, we would deadlock.
173171
*/
174172
nofs_flag = memalloc_nofs_save();
175173
ret = kvzalloc(bitmap_rounded_size, GFP_KERNEL);

0 commit comments

Comments
 (0)