When disk is failed by mdadm e.g.: mdadm -f /dev/md/raid_array /dev/sdX and then it is tried to be removed from container e.g.: mdadm --remove /dev/md/container /dev/sdX mdadm refuses it with information: mdadm: /dev/sdX is still in use, cannot remove. Problem was introduced in commit: monitor: don't unblock a device that isn't blocked. /2011-12-06/ Disk without unblocking it cannot be really removed from array and reference to if is still reported under 'holders' sysfs entry. As this commit is necessary for managing degraded array during reshape and rebuild code for unconditional unblocking disk on removal is added. Guard for setting DS_UNBLOCK during reshape/rebuild avoids process performance degradation. Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx> --- monitor.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/monitor.c b/monitor.c index 29bde18..ce66625 100644 --- a/monitor.c +++ b/monitor.c @@ -346,6 +346,12 @@ static int read_and_act(struct active_array *a) a->next_state = active; } if (a->curr_state > readonly) + /* For disk removal when no md process + * /e.g. reshape/ is in progress, trigger + * unconditional device unblock first + */ + if (a->curr_action == idle) + mdi->next_state |= DS_UNBLOCK; mdi->next_state |= DS_REMOVE; } } -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html