All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: take delayed_node mutex when releasing item
@ 2025-11-12  0:22 Leo Martins
  2025-11-12  7:09 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Martins @ 2025-11-12  0:22 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

The error path in btrfs_delete_delayed_dir_index does not take
the delayed_node mutex when releasing delayed item.
btrfs_release_delayed_item -> __btrfs_remove_delayed_item which
has lockdep_assert_held(&delayed_node->mutex)

Fix this by taking the mutex when releasing.

Fixes: 933c22a7512c ("btrfs: delayed-inode: Kill the BUG_ON() in btrfs_delete_delayed_dir_index()")
Signed-off-by: Leo Martins <loemra.dev@gmail.com>
---
 fs/btrfs/delayed-inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index e77a597580c5..30dd067e2db3 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1662,7 +1662,9 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
 		btrfs_err(trans->fs_info,
 "metadata reservation failed for delayed dir item deletion, index: %llu, root: %llu, inode: %llu, error: %d",
 			  index, btrfs_root_id(node->root), node->inode_id, ret);
+		mutex_lock(&node->mutex);
 		btrfs_release_delayed_item(item);
+		mutex_unlock(&node->mutex);
 		goto end;
 	}
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-12 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12  0:22 [PATCH] btrfs: take delayed_node mutex when releasing item Leo Martins
2025-11-12  7:09 ` David Sterba
2025-11-12 17:03   ` Leo Martins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.