From: Filipe Manana <fdmanana@suse.com>
Date: Wed, 23 Oct 2024 11:48:15 +0000 (+0100)
Subject: btrfs: assert delayed refs lock is held at add_delayed_ref_head()
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a8985ac6bed0546da493ebdd08238de60f0b1a04;p=users%2Fdwmw2%2Flinux.git

btrfs: assert delayed refs lock is held at add_delayed_ref_head()

The delayed refs lock must be held when calling add_delayed_ref_head(),
so assert that it's being held.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index f74154c564320..018c9765702cd 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -886,6 +886,7 @@ add_delayed_ref_head(struct btrfs_trans_handle *trans,
 	bool qrecord_inserted = false;
 
 	delayed_refs = &trans->transaction->delayed_refs;
+	lockdep_assert_held(&delayed_refs->lock);
 
 	/* Record qgroup extent info if provided */
 	if (qrecord) {