Commit 25d8c284 authored by Miao Xie's avatar Miao Xie Committed by Josef Bacik

Btrfs: remove the code for the impossible case in cleanup_transaction()

If the transaction is removed from the transaction list, it means the
transaction has been committed successfully. So it is impossible to
call cleanup_transaction(), otherwise there is something wrong with
the code logic. Thus, we use BUG_ON() instead of the original handle.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent ac673879
...@@ -1450,11 +1450,12 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, ...@@ -1450,11 +1450,12 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans,
spin_lock(&root->fs_info->trans_lock); spin_lock(&root->fs_info->trans_lock);
if (list_empty(&cur_trans->list)) { /*
spin_unlock(&root->fs_info->trans_lock); * If the transaction is removed from the list, it means this
btrfs_end_transaction(trans, root); * transaction has been committed successfully, so it is impossible
return; * to call the cleanup function.
} */
BUG_ON(list_empty(&cur_trans->list));
list_del_init(&cur_trans->list); list_del_init(&cur_trans->list);
if (cur_trans == root->fs_info->running_transaction) { if (cur_trans == root->fs_info->running_transaction) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment