Skip to content

Commit

Permalink
Btrfs: run delayed directory updates during log replay
Browse files Browse the repository at this point in the history
While we are resolving directory modifications in the
tree log, we are triggering delayed metadata updates to
the filesystem btrees.

This commit forces the delayed updates to run so the
replay code can find any modifications done.  It stops
us from crashing because the directory deleltion replay
expects items to be removed immediately from the tree.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
cc: stable@kernel.org
  • Loading branch information
Chris Mason committed Jul 2, 2012
1 parent 7fd1a3f commit b630556
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
kfree(name);

iput(inode);

btrfs_run_delayed_items(trans, root);
return ret;
}

Expand Down Expand Up @@ -895,6 +897,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
ret = btrfs_unlink_inode(trans, root, dir,
inode, victim_name,
victim_name_len);
btrfs_run_delayed_items(trans, root);
}
kfree(victim_name);
ptr = (unsigned long)(victim_ref + 1) + victim_name_len;
Expand Down Expand Up @@ -1475,6 +1478,9 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
ret = btrfs_unlink_inode(trans, root, dir, inode,
name, name_len);
BUG_ON(ret);

btrfs_run_delayed_items(trans, root);

kfree(name);
iput(inode);

Expand Down

0 comments on commit b630556

Please sign in to comment.