Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 3 Jul 2014 10:22:12 +0000 (18:22 +0800)
committerChris Mason <clm@fb.com>
Tue, 19 Aug 2014 15:36:32 +0000 (08:36 -0700)
We forgot to zero some members in fs_devices when we create new fs_devices
from the one of the seed fs. It would cause the problem that we got wrong
chunk profile when allocating chunks. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/volumes.c

index 5700ab03e84bba10a4b5c4920eadced5099a8fc5..50edbbc2e76cd495b3cbbdbee98084936dd366c8 100644 (file)
@@ -1988,6 +1988,9 @@ static int btrfs_prepare_sprout(struct btrfs_root *root)
        fs_devices->seeding = 0;
        fs_devices->num_devices = 0;
        fs_devices->open_devices = 0;
+       fs_devices->missing_devices = 0;
+       fs_devices->num_can_discard = 0;
+       fs_devices->rotating = 0;
        fs_devices->seed = seed_devices;
 
        generate_random_uuid(fs_devices->fsid);