aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2014-09-03 09:35:33 -0400
committerChris Mason <clm@fb.com>2014-09-17 16:38:33 -0400
commit935e5cc935bcbf9b3d0dd59fed7dbc0f2ebca6bc (patch)
tree2489d657687317839ab01cd1c617356851839726 /fs/btrfs/transaction.c
parent1c43366d3b3f0fa6c6e81aaf3aa18e0550245dad (diff)
Btrfs: fix wrong disk size when writing super blocks
total_size will be changed when resizing a device, and disk_total_size will be changed if resizing is successful. Meanwhile, the on-disk super blocks of the previous transaction might not be updated. Considering the consistency of the metadata in the previous transaction, We should use the size in the previous transaction to check if the super block is beyond the boundary of the device. Fix it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index e336646508fe..2f7c0bef4043 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1868,6 +1868,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1868 memcpy(root->fs_info->super_for_commit, root->fs_info->super_copy, 1868 memcpy(root->fs_info->super_for_commit, root->fs_info->super_copy,
1869 sizeof(*root->fs_info->super_copy)); 1869 sizeof(*root->fs_info->super_copy));
1870 1870
1871 btrfs_update_commit_device_size(root->fs_info);
1872
1871 spin_lock(&root->fs_info->trans_lock); 1873 spin_lock(&root->fs_info->trans_lock);
1872 cur_trans->state = TRANS_STATE_UNBLOCKED; 1874 cur_trans->state = TRANS_STATE_UNBLOCKED;
1873 root->fs_info->running_transaction = NULL; 1875 root->fs_info->running_transaction = NULL;