Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdadm --assemble --scan exits with status 2 if there is nothing to assemble #144

Open
cemysce opened this issue Jan 26, 2025 · 1 comment

Comments

@cemysce
Copy link

cemysce commented Jan 26, 2025

These days there are udev rules and possibly other mechanisms by which arrays may already be assembled by the time someone or some script (perhaps an init script) runs mdadm --assemble --scan. Problems arise when mdadm subsequently exits with status 2, because the caller will handle that as a failure even though from its perspective everything is actually fine. In an init script, for example, this may cause dependent init scripts to fail to start.

Furthermore, while exit statuses are documented for some of the other modes, they do not appear to be documented for --assemble mode. If for some reason the exit status for this case cannot be changed to 0, then please at the very least exit with some unique documented status that callers can check for specifically.

Here are a couple of examples of downstream bug reports due to this behavior:

@mtkaczyk
Copy link
Member

Hello @cemysce
It probably comes from here:
https://github.com/md-raid-utilities/mdadm/blob/main/mdadm.c#L1759
but there could be other places like that..

Assemble implementation is hard to follow. I think that it would be easier and safer to write new assemble module instead.
Can you propose documentation that would satisfy your needs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants