diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-06-26 10:06:50 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-06-26 10:06:50 -0400 |
commit | 4b52dff6d371b9b93bc99f64c32831ea9a8ec3ac (patch) | |
tree | 160a5fb1d8ab8e593775962aedac6ef770da7f3c /fs/btrfs/transaction.c | |
parent | 79c44584ea346024e929ac0f2a3577aac33b7b3f (diff) |
Btrfs: Fix super block updates during transaction commit
The super block written during commit was not consistent with the state of
the trees. This change adds an in-memory copy of the super so that we can
make sure to write out consistent data during a commit.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index a5a63d471e43..3b2face593e9 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -380,6 +380,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
380 | else | 380 | else |
381 | prev_trans->use_count++; | 381 | prev_trans->use_count++; |
382 | } | 382 | } |
383 | btrfs_set_super_generation(&root->fs_info->super_copy, | ||
384 | cur_trans->transid); | ||
385 | btrfs_set_super_root(&root->fs_info->super_copy, | ||
386 | bh_blocknr(root->fs_info->tree_root->node)); | ||
387 | memcpy(root->fs_info->disk_super, &root->fs_info->super_copy, | ||
388 | sizeof(root->fs_info->super_copy)); | ||
383 | mutex_unlock(&root->fs_info->trans_mutex); | 389 | mutex_unlock(&root->fs_info->trans_mutex); |
384 | mutex_unlock(&root->fs_info->fs_mutex); | 390 | mutex_unlock(&root->fs_info->fs_mutex); |
385 | ret = btrfs_write_and_wait_transaction(trans, root); | 391 | ret = btrfs_write_and_wait_transaction(trans, root); |
@@ -389,8 +395,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
389 | put_transaction(prev_trans); | 395 | put_transaction(prev_trans); |
390 | mutex_unlock(&root->fs_info->trans_mutex); | 396 | mutex_unlock(&root->fs_info->trans_mutex); |
391 | } | 397 | } |
392 | btrfs_set_super_generation(root->fs_info->disk_super, | ||
393 | cur_trans->transid); | ||
394 | BUG_ON(ret); | 398 | BUG_ON(ret); |
395 | write_ctree_super(trans, root); | 399 | write_ctree_super(trans, root); |
396 | 400 | ||