]> git.ipfire.org Git - thirdparty/systemd.git/commit
shutdown: handle gracefully if a device disappears while we detach it
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Apr 2025 12:39:34 +0000 (14:39 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 17 Apr 2025 21:03:03 +0000 (06:03 +0900)
commit2791b2bc3d84efe674d05e45fa85333eea05ad6f
tree957d80145c646e92cbd411a943364f5fff299df3
parent7baf24c94960f824e815d744a8e46511bf9ab40b
shutdown: handle gracefully if a device disappears while we detach it

Let's gracefully handle cases where a device disappears in the time we
between our discovery and when we want to detach it, due to "auto-clear"
or a similar logic.

The loopback case already handled this quite OK, do the same for MD and
swap too.

Switch to ERRNO_IS_DEVICE_ABSENT() for all checks, just in case.

Also improve debug logging for all these cases, so we know exactly what
is going on.

This is inspired by #37160, but shouldn't really fix anything there, I
am pretty sure the ENODEV seen in that output stems from the STOP_ARRAY
call, not from the open().

Note that this does not change anything for the device mapper case,
because the DM subsystem does not return useful error codes to
userspace, hence everything is a complete mess there.
src/shutdown/detach-loopback.c
src/shutdown/detach-md.c
src/shutdown/detach-swap.c