Commit 67cde344 authored by Miao Xie's avatar Miao Xie Committed by Chris Mason

Btrfs: destroy the items of the delayed inodes in error handling routine

the items of the delayed inodes were forgotten to be freed, this patch
fixes it.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent ed0eaa14
...@@ -1879,3 +1879,21 @@ void btrfs_kill_all_delayed_nodes(struct btrfs_root *root) ...@@ -1879,3 +1879,21 @@ void btrfs_kill_all_delayed_nodes(struct btrfs_root *root)
} }
} }
} }
void btrfs_destroy_delayed_inodes(struct btrfs_root *root)
{
struct btrfs_delayed_root *delayed_root;
struct btrfs_delayed_node *curr_node, *prev_node;
delayed_root = btrfs_get_delayed_root(root);
curr_node = btrfs_first_delayed_node(delayed_root);
while (curr_node) {
__btrfs_kill_delayed_node(curr_node);
prev_node = curr_node;
curr_node = btrfs_next_delayed_node(curr_node);
btrfs_release_delayed_node(prev_node);
}
}
...@@ -124,6 +124,9 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev); ...@@ -124,6 +124,9 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev);
/* Used for drop dead root */ /* Used for drop dead root */
void btrfs_kill_all_delayed_nodes(struct btrfs_root *root); void btrfs_kill_all_delayed_nodes(struct btrfs_root *root);
/* Used for clean the transaction */
void btrfs_destroy_delayed_inodes(struct btrfs_root *root);
/* Used for readdir() */ /* Used for readdir() */
void btrfs_get_delayed_items(struct inode *inode, struct list_head *ins_list, void btrfs_get_delayed_items(struct inode *inode, struct list_head *ins_list,
struct list_head *del_list); struct list_head *del_list);
......
...@@ -3608,6 +3608,9 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans, ...@@ -3608,6 +3608,9 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
cur_trans->commit_done = 1; cur_trans->commit_done = 1;
wake_up(&cur_trans->commit_wait); wake_up(&cur_trans->commit_wait);
btrfs_destroy_delayed_inodes(root);
btrfs_assert_delayed_root_empty(root);
btrfs_destroy_pending_snapshots(cur_trans); btrfs_destroy_pending_snapshots(cur_trans);
btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages, btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages,
...@@ -3662,6 +3665,9 @@ int btrfs_cleanup_transaction(struct btrfs_root *root) ...@@ -3662,6 +3665,9 @@ int btrfs_cleanup_transaction(struct btrfs_root *root)
if (waitqueue_active(&t->commit_wait)) if (waitqueue_active(&t->commit_wait))
wake_up(&t->commit_wait); wake_up(&t->commit_wait);
btrfs_destroy_delayed_inodes(root);
btrfs_assert_delayed_root_empty(root);
btrfs_destroy_pending_snapshots(t); btrfs_destroy_pending_snapshots(t);
btrfs_destroy_delalloc_inodes(root); btrfs_destroy_delalloc_inodes(root);
......
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