From 8f63a84051e8e42aa99291197e4adae67241a705 Mon Sep 17 00:00:00 2001 From: Su Yue Date: Wed, 28 Nov 2018 11:21:12 +0800 Subject: [PATCH] btrfs: switch order of unlocks of space_info and bg in do_trimming() In function do_trimming(), block_group->lock should be unlocked first, as the locks should be released in the reverse order. This does not cause problems but should follow the best practices. Reviewed-by: Nikolay Borisov Signed-off-by: Su Yue Reviewed-by: David Sterba [ update changelog ] Signed-off-by: David Sterba --- fs/btrfs/free-space-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index f74dc259307b..9a76e7671938 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -3166,8 +3166,8 @@ static int do_trimming(struct btrfs_block_group_cache *block_group, space_info->bytes_readonly += reserved_bytes; block_group->reserved -= reserved_bytes; space_info->bytes_reserved -= reserved_bytes; - spin_unlock(&space_info->lock); spin_unlock(&block_group->lock); + spin_unlock(&space_info->lock); } return ret; -- 2.30.2