From: rtapadia730@gmail.com
To: dsterba@suse.com, clm@fb.com, fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, khalid@kernel.org,
david.hunter.linux@gmail.com,
Rajeev Tapadia <rtapadia730@gmail.com>
Subject: [PATCH v2] btrfs: fix comment in alloc_bitmap() and drop stale TODO
Date: Fri, 3 Oct 2025 19:00:02 +0530 [thread overview]
Message-ID: <20251003133001.45052-2-rtapadia730@gmail.com> (raw)
From: Rajeev Tapadia <rtapadia730@gmail.com>
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.
Signed-off-by: Rajeev Tapadia <rtapadia730@gmail.com>
---
Change log:
As per previous review the change is not required. So just removing the
stale TODO.
fs/btrfs/free-space-tree.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index dad0b492a663..bb8ca7b679be 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -165,11 +165,9 @@ static unsigned long *alloc_bitmap(u32 bitmap_size)
/*
* GFP_NOFS doesn't work with kvmalloc(), but we really can't recurse
- * into the filesystem as the free space bitmap can be modified in the
- * critical section of a transaction commit.
- *
- * TODO: push the memalloc_nofs_{save,restore}() to the caller where we
- * know that recursion is unsafe.
+ * into the filesystem here. All callers hold a transaction handle
+ * open, so if a GFP_KERNEL allocation recurses into the filesystem
+ * and triggers a transaction commit, we would deadlock.
*/
nofs_flag = memalloc_nofs_save();
ret = kvzalloc(bitmap_rounded_size, GFP_KERNEL);
--
2.51.0
next reply other threads:[~2025-10-03 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 13:30 rtapadia730 [this message]
2025-10-03 15:11 ` [PATCH v2] btrfs: fix comment in alloc_bitmap() and drop stale TODO Filipe Manana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251003133001.45052-2-rtapadia730@gmail.com \
--to=rtapadia730@gmail.com \
--cc=clm@fb.com \
--cc=david.hunter.linux@gmail.com \
--cc=dsterba@suse.com \
--cc=fdmanana@kernel.org \
--cc=khalid@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox