@@ -2103,6 +2103,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
if (btrfs_super_log_root(disk_super) != 0 &&
!(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) {
u64 bytenr = btrfs_super_log_root(disk_super);
+ u64 log_root_transid = btrfs_super_log_root_transid(disk_super);
if (fs_devices->rw_devices == 0) {
printk(KERN_WARNING "Btrfs log replay required "
@@ -2125,7 +2126,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
log_tree_root->node = read_tree_block(tree_root, bytenr,
blocksize,
- generation + 1);
+ log_root_transid);
ret = btrfs_recover_log_trees(log_tree_root);
BUG_ON(ret);
@@ -2089,6 +2089,8 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
log_root_tree->node->start);
btrfs_set_super_log_root_level(&root->fs_info->super_for_commit,
btrfs_header_level(log_root_tree->node));
+ btrfs_set_super_log_root_transid(&root->fs_info->super_for_commit,
+ trans->transid);
log_root_tree->log_batch = 0;
log_root_tree->log_transid++;