diff mbox series

btrfs: fix unbalanced unlock in qgroup_account_snapshot()

Message ID 20210621012114.1884779-1-naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: fix unbalanced unlock in qgroup_account_snapshot() | expand

Commit Message

Naohiro Aota June 21, 2021, 1:21 a.m. UTC
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 <stable@vger.kernel.org> # 5.12
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/transaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Qu Wenruo June 21, 2021, 1:33 a.m. UTC | #1
On 2021/6/21 上午9:21, Naohiro Aota wrote:
> 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 <stable@vger.kernel.org> # 5.12
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/transaction.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index f75de9f6c0ad..6aca64cf77dc 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -1476,7 +1476,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;
>   	}
>
>   	/*
>
David Sterba June 21, 2021, 4:17 p.m. UTC | #2
On Mon, Jun 21, 2021 at 10:21:14AM +0900, Naohiro Aota wrote:
> 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 <stable@vger.kernel.org> # 5.12
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index f75de9f6c0ad..6aca64cf77dc 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1476,7 +1476,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;
 	}
 
 	/*