The md device might not have personality (for example, ddf raid array). The
issue is introduced by
8430e7e0af9a15(md: disconnect device from personality
before trying to remove it)
Reported-by: kernel test robot <xiaolong.ye@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
else
err = -EBUSY;
} else if (cmd_match(buf, "remove")) {
- clear_bit(Blocked, &rdev->flags);
- remove_and_add_spares(rdev->mddev, rdev);
+ if (rdev->mddev->pers) {
+ clear_bit(Blocked, &rdev->flags);
+ remove_and_add_spares(rdev->mddev, rdev);
+ }
if (rdev->raid_disk >= 0)
err = -EBUSY;
else {