summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2014-06-03 07:36:02 +0400
committerChris Mason <clm@fb.com>2014-06-29 00:48:44 +0400
commit49c6f736f34f901117c20960ebd7d5e60f12fcac (patch)
treed22f55873aa6e348fc702a80128b49348a64d913
parent0d39376aa28eba6d63d0120ccc399735842abc8e (diff)
downloadlinux-49c6f736f34f901117c20960ebd7d5e60f12fcac.tar.xz
btrfs: dev replace should replace the sysfs entry
when we replace the device its corresponding sysfs entry has to be replaced as well Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/dev-replace.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 2af6e66fe788..eea26e1b2fda 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -36,6 +36,7 @@
#include "check-integrity.h"
#include "rcu-string.h"
#include "dev-replace.h"
+#include "sysfs.h"
static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
int scrub_ret);
@@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
fs_info->fs_devices->latest_bdev = tgt_device->bdev;
list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
+ /* replace the sysfs entry */
+ btrfs_kobj_rm_device(fs_info, src_device);
+ btrfs_kobj_add_device(fs_info, tgt_device);
+
btrfs_rm_dev_replace_blocked(fs_info);
btrfs_rm_dev_replace_srcdev(fs_info, src_device);