From: Filipe Manana Date: Mon, 19 Sep 2022 14:06:36 +0000 (+0100) Subject: btrfs: assert tree is locked when clearing extent map from logging X-Git-Tag: v6.6.17~6129^2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74333c7d87914ef1c250d3ea9441e88e15039bd8;p=platform%2Fkernel%2Flinux-rpi.git btrfs: assert tree is locked when clearing extent map from logging When calling clear_em_logging() we should have a write lock on the extent map tree, as we will try to merge the extent map with the previous and next ones in the tree. So assert that we have a write lock. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 6b7eee9..f1616aa 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -334,6 +334,8 @@ out: void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em) { + lockdep_assert_held_write(&tree->lock); + clear_bit(EXTENT_FLAG_LOGGING, &em->flags); if (extent_map_in_tree(em)) try_merge_map(tree, em);