Skip to content

Commit 49c6f73

Browse files
asjmasoncl
authored andcommitted
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 <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 0d39376 commit 49c6f73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/btrfs/dev-replace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "check-integrity.h"
3737
#include "rcu-string.h"
3838
#include "dev-replace.h"
39+
#include "sysfs.h"
3940

4041
static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
4142
int scrub_ret);
@@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
562563
fs_info->fs_devices->latest_bdev = tgt_device->bdev;
563564
list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
564565

566+
/* replace the sysfs entry */
567+
btrfs_kobj_rm_device(fs_info, src_device);
568+
btrfs_kobj_add_device(fs_info, tgt_device);
569+
565570
btrfs_rm_dev_replace_blocked(fs_info);
566571

567572
btrfs_rm_dev_replace_srcdev(fs_info, src_device);

0 commit comments

Comments
 (0)