diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-05-15 03:48:26 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-06-14 11:29:45 -0400 |
commit | 25d8c284c7d9b9d536a1334f6b670645da971a19 (patch) | |
tree | f2d7c360b2ec1b3cfb02793890cd92a87cecba92 | |
parent | ac6738792fe4478df2da9c1f41e3540e9ef79604 (diff) |
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: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r-- | fs/btrfs/transaction.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bc22be9b69b4..cf8706ce85ac 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1450,11 +1450,12 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, | |||
1450 | 1450 | ||
1451 | spin_lock(&root->fs_info->trans_lock); | 1451 | spin_lock(&root->fs_info->trans_lock); |
1452 | 1452 | ||
1453 | if (list_empty(&cur_trans->list)) { | 1453 | /* |
1454 | spin_unlock(&root->fs_info->trans_lock); | 1454 | * If the transaction is removed from the list, it means this |
1455 | btrfs_end_transaction(trans, root); | 1455 | * transaction has been committed successfully, so it is impossible |
1456 | return; | 1456 | * to call the cleanup function. |
1457 | } | 1457 | */ |
1458 | BUG_ON(list_empty(&cur_trans->list)); | ||
1458 | 1459 | ||
1459 | list_del_init(&cur_trans->list); | 1460 | list_del_init(&cur_trans->list); |
1460 | if (cur_trans == root->fs_info->running_transaction) { | 1461 | if (cur_trans == root->fs_info->running_transaction) { |