aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2014-06-02 23:36:03 -0400
committerChris Mason <clm@fb.com>2014-06-28 16:48:44 -0400
commitb2373f255cacdc1ea4da25e75a5a78949ffd9d66 (patch)
tree36d5c83ec523fab5d08c15847a22f4802699bc09 /fs
parent49c6f736f34f901117c20960ebd7d5e60f12fcac (diff)
btrfs: create sprout should rename fsid on the sysfs as well
Creating sprout will change the fsid of the mounted root. do the same on the sysfs as well. reproducer: mount /dev/sdb /btrfs (seed disk) btrfs dev add /dev/sdc /btrfs mount -o rw,remount /btrfs btrfs dev del /dev/sdb /btrfs mount /dev/sdb /btrfs Error: kobject_add_internal failed for fe350492-dc28-4051-a601-e017b17e6145 with -EEXIST, don't try to register things with the same name in the same directory. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/volumes.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 19b67e969b52..6ca0d9cc46f9 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2154,6 +2154,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
2154 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 2154 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
2155 2155
2156 if (seeding_dev) { 2156 if (seeding_dev) {
2157 char fsid_buf[BTRFS_UUID_UNPARSED_SIZE];
2157 ret = init_first_rw_device(trans, root, device); 2158 ret = init_first_rw_device(trans, root, device);
2158 if (ret) { 2159 if (ret) {
2159 btrfs_abort_transaction(trans, root, ret); 2160 btrfs_abort_transaction(trans, root, ret);
@@ -2164,6 +2165,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
2164 btrfs_abort_transaction(trans, root, ret); 2165 btrfs_abort_transaction(trans, root, ret);
2165 goto error_trans; 2166 goto error_trans;
2166 } 2167 }
2168
2169 /* Sprouting would change fsid of the mounted root,
2170 * so rename the fsid on the sysfs
2171 */
2172 snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU",
2173 root->fs_info->fsid);
2174 if (kobject_rename(&root->fs_info->super_kobj, fsid_buf))
2175 goto error_trans;
2167 } else { 2176 } else {
2168 ret = btrfs_add_device(trans, root, device); 2177 ret = btrfs_add_device(trans, root, device);
2169 if (ret) { 2178 if (ret) {