aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2014-07-23 23:37:09 -0400
committerChris Mason <clm@fb.com>2014-09-17 16:37:44 -0400
commit5f546063cee93047af90cf2756e023da9f9fca51 (patch)
treea8ed537e39112c1d6a07d41f33b2f83cb56aa345 /fs
parent17a9be2f28595945ec9bfac0dd15b86891c1f1de (diff)
Btrfs: fix wrong generation check of super block on a seed device
The super block generation of the seed devices is not the same as the filesystem which sprouted from them because we don't update the super block on the seed devices when we change that new filesystem. So we should not use the generation of that new filesystem to check the super block generation on the seed devices, Fix it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/scrub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index d1aa95a4f843..72c8981e7c0a 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2832,7 +2832,11 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
2832 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) 2832 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
2833 return -EIO; 2833 return -EIO;
2834 2834
2835 gen = root->fs_info->last_trans_committed; 2835 /* Seed devices of a new filesystem has their own generation. */
2836 if (scrub_dev->fs_devices != root->fs_info->fs_devices)
2837 gen = scrub_dev->generation;
2838 else
2839 gen = root->fs_info->last_trans_committed;
2836 2840
2837 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { 2841 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
2838 bytenr = btrfs_sb_offset(i); 2842 bytenr = btrfs_sb_offset(i);