Btrfs: fix wrong missing device counter decrease
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 16 Jul 2014 10:38:01 +0000 (18:38 +0800)
committerChris Mason <clm@fb.com>
Tue, 19 Aug 2014 15:52:10 +0000 (08:52 -0700)
The missing devices are accounted by its own fs device, for example
the missing devices in seed filesystem will be accounted by the fs device
of the seed filesystem, not by the new filesystem which is based on
the seed filesystem, so when we remove the missing device in the
seed filesystem, we should decrease the counter of its own fs device.
Fix it.

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

index 50edbbc2e76cd495b3cbbdbee98084936dd366c8..da0e632a21fc6b17c9d74913145f152aa91579e1 100644 (file)
@@ -1718,7 +1718,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
        device->fs_devices->total_devices--;
 
        if (device->missing)
-               root->fs_info->fs_devices->missing_devices--;
+               device->fs_devices->missing_devices--;
 
        next_device = list_entry(root->fs_info->fs_devices->devices.next,
                                 struct btrfs_device, dev_list);