Checking for dedup references needs to allocate memory so it cannot be run within spin_lock, otherwise it will end up with heavy deadlock. Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx> --- fs/btrfs/extent-tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a8da7aa..4c1c342 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5720,7 +5720,6 @@ again: dedup_hash = 0; path->reada = 1; - path->leave_spinning = 1; is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID; BUG_ON(!is_data && refs_to_drop != 1); @@ -5774,7 +5773,6 @@ again: goto out; } btrfs_release_path(path); - path->leave_spinning = 1; key.objectid = bytenr; key.type = BTRFS_EXTENT_ITEM_KEY; @@ -5942,6 +5940,7 @@ again: dedup_hash = extent_data_ref_offset(root, path, iref); + WARN_ON_ONCE(path->leave_spinning); ret = btrfs_free_dedup_extent(trans, root, dedup_hash, bytenr); if (ret) { -- 1.8.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html