diff mbox

Btrfs: sysfs support for the replace of the seed device

Message ID 1433670272-1563-2-git-send-email-anand.jain@oracle.com (mailing list archive)
State Under Review
Headers show

Commit Message

Anand Jain June 7, 2015, 9:44 a.m. UTC
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.jain@oracle.com>
 fs/btrfs/dev-replace.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox


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 */