|
@@ -2154,6 +2154,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
|
|
|
mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
|
|
|
|
|
|
if (seeding_dev) {
|
|
|
+ char fsid_buf[BTRFS_UUID_UNPARSED_SIZE];
|
|
|
ret = init_first_rw_device(trans, root, device);
|
|
|
if (ret) {
|
|
|
btrfs_abort_transaction(trans, root, ret);
|
|
@@ -2164,6 +2165,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
|
|
|
btrfs_abort_transaction(trans, root, ret);
|
|
|
goto error_trans;
|
|
|
}
|
|
|
+
|
|
|
+ /* Sprouting would change fsid of the mounted root,
|
|
|
+ * so rename the fsid on the sysfs
|
|
|
+ */
|
|
|
+ snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU",
|
|
|
+ root->fs_info->fsid);
|
|
|
+ if (kobject_rename(&root->fs_info->super_kobj, fsid_buf))
|
|
|
+ goto error_trans;
|
|
|
} else {
|
|
|
ret = btrfs_add_device(trans, root, device);
|
|
|
if (ret) {
|