OSDN Git Service

btrfs: fix unbalanced unlock in qgroup_account_snapshot()
authorNaohiro Aota <naohiro.aota@wdc.com>
Mon, 21 Jun 2021 01:21:14 +0000 (10:21 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 22 Jun 2021 12:11:57 +0000 (14:11 +0200)
qgroup_account_snapshot() is trying to unlock the not taken
tree_log_mutex in a error path. Since ret != 0 in this case, we can
just return from here.

Fixes: 2a4d84c11a87 ("btrfs: move delayed ref flushing for qgroup into qgroup helper")
CC: stable@vger.kernel.org # 5.12+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c

index 73df8b8..57be211 100644 (file)
@@ -1478,7 +1478,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans,
        ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
        if (ret) {
                btrfs_abort_transaction(trans, ret);
-               goto out;
+               return ret;
        }
 
        /*