btrfs: fix memory leak when there is no more seed device
authorAnand Jain <Anand.Jain@oracle.com>
Wed, 13 Aug 2014 06:24:23 +0000 (14:24 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:38:09 +0000 (13:38 -0700)
When we replace all the seed device in the system there is
no point in just keeping the btrfs_fs_devices with out
any device

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/volumes.c

index 27a14f1c5a7c34813514f8d55bc1f39e544dc428..94a0d186de4c9e083ca3c3f4fcafe415b07cd115 100644 (file)
@@ -1868,6 +1868,8 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info,
                        tmp_fs_devices = tmp_fs_devices->seed;
                }
                fs_devices->seed = NULL;
+               __btrfs_close_devices(fs_devices);
+               free_fs_devices(fs_devices);
        }
 }