Commit c0ffeb6
md: allow removing faulty rdev during resync
During RAID resync, faulty rdev cannot be removed and will result in
"Device or resource busy" error when attempting hot removal.
Reproduction steps:
mdadm -Cv /dev/md0 -l1 -n3 -e1.2 /dev/sd{b..d}
mdadm /dev/md0 -f /dev/sdb
mdadm /dev/md0 -r /dev/sdb
-> mdadm: hot remove failed for /dev/sdb: Device or resource busy
After commit 4b10a3b ("md: ensure resync is prioritized over
recovery"), when a device becomes faulty during resync, the
md_choose_sync_action() function returns early without calling
remove_and_add_spares(), preventing faulty device removal.
This patch extracts a helper function remove_spares() to support
removing faulty devices during RAID resync operations.
Fixes: 4b10a3b ("md: ensure resync is prioritized over recovery")
Signed-off-by: Zheng Qixing <[email protected]>
Reviewed-by: Li Nan <[email protected]>
Link: https://lore.kernel.org/linux-raid/[email protected]
Signed-off-by: Yu Kuai <[email protected]>1 parent 3ec8db6 commit c0ffeb6
1 file changed
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9459 | 9459 | | |
9460 | 9460 | | |
9461 | 9461 | | |
9462 | | - | |
9463 | | - | |
| 9462 | + | |
9464 | 9463 | | |
9465 | 9464 | | |
9466 | | - | |
9467 | 9465 | | |
9468 | 9466 | | |
9469 | | - | |
9470 | | - | |
9471 | | - | |
9472 | | - | |
9473 | 9467 | | |
9474 | 9468 | | |
9475 | 9469 | | |
| |||
9483 | 9477 | | |
9484 | 9478 | | |
9485 | 9479 | | |
| 9480 | + | |
| 9481 | + | |
| 9482 | + | |
| 9483 | + | |
| 9484 | + | |
| 9485 | + | |
| 9486 | + | |
| 9487 | + | |
| 9488 | + | |
| 9489 | + | |
| 9490 | + | |
| 9491 | + | |
| 9492 | + | |
| 9493 | + | |
| 9494 | + | |
9486 | 9495 | | |
9487 | 9496 | | |
9488 | 9497 | | |
| |||
9525 | 9534 | | |
9526 | 9535 | | |
9527 | 9536 | | |
| 9537 | + | |
9528 | 9538 | | |
9529 | 9539 | | |
9530 | 9540 | | |
| |||
0 commit comments