when we replace the device its corresponding sysfs entry has to be replaced as well
Unified · Split
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "check-integrity.h" |
| 37 | 37 | #include "rcu-string.h" |
| 38 | 38 | #include "dev-replace.h" |
| 39 | +#include "sysfs.h" | |
| 39 | 40 | |
| 40 | 41 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
| 41 | 42 | int scrub_ret); |
| @@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, · 520 unmodified lines | ||
| 562 | 563 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; |
| 563 | 564 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); |
| 564 | 565 | |
| 566 | + /* replace the sysfs entry */ | |
| 567 | + btrfs_kobj_rm_device(fs_info, src_device); | |
| 568 | + btrfs_kobj_add_device(fs_info, tgt_device); | |
| 569 | + | |
| 565 | 570 | btrfs_rm_dev_replace_blocked(fs_info); |
| 566 | 571 | |
| 567 | 572 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); |