Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f546063 authored by Miao Xie's avatar Miao Xie Committed by Chris Mason
Browse files

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: default avatarMiao Xie <miaox@cn.fujitsu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 17a9be2f
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -2832,6 +2832,10 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
	if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
	if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
		return -EIO;
		return -EIO;


	/* Seed devices of a new filesystem has their own generation. */
	if (scrub_dev->fs_devices != root->fs_info->fs_devices)
		gen = scrub_dev->generation;
	else
		gen = root->fs_info->last_trans_committed;
		gen = root->fs_info->last_trans_committed;


	for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
	for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {