Earlier as reported "replace seed/sprout hangs (regression ?)"
and since now I don't see that regression, was able to test
this scenario. And thus added the support in the sysfs.

Test case
 mount seed device
 add sprout
 replace seed device
 (so now sprout fs is independent of seed fs)
 The sysfs layout should change accordingly.

Signed-off-by: Anand Jain <anand.j...@oracle.com>
---
 fs/btrfs/dev-replace.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index a6a2b84..5a6f732 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -585,7 +585,11 @@ static int btrfs_dev_replace_finishing(struct 
btrfs_fs_info *fs_info,
 
        /* replace the sysfs entry */
        btrfs_sysfs_rm_device_link(fs_info->fs_devices, src_device, 0);
-       btrfs_sysfs_rm_device_attr(src_device);
+       if (src_device->fs_devices->seeding &&
+                       !src_device->fs_devices->num_devices)
+               btrfs_sysfs_remove_fsid(src_device->fs_devices);
+       else
+               btrfs_sysfs_rm_device_attr(src_device);
        btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
 
        /* write back the superblocks */
-- 
2.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to