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

ensure blk_availability only deactivates devices after local-fs.target #18

Open
cpaelzer opened this issue Jun 19, 2019 · 2 comments
Open

Comments

@cpaelzer
Copy link

Hi,
in a bug to Ubuntu I got a case reported where the lack of ordering on shutdown causes issues.
I have seen #17 but that only guarantees to have blk_availability complete before reaching shutdown, this is different.

On shutdown due to a lack of Before statements or any other service depending on it via After means that blk_availability will start very early in the shutdown ordering. That can lead to cases (see reported bug) where devices and associated filesystems are gone while still being needed.

If there is any other safeguard that should avoid this, but failing in this case let me know.
Just looking at systemd for shutdown ordering I'd have expected that we'd want to start blkdeactivate only after local-fs.target is reached.

That would mean any services needing local disks/FS are done and that implies we can safely blkdeactivate now.

cpaelzer added a commit to cpaelzer/lvm2 that referenced this issue Jun 19, 2019
Currently on shutdown blk_availability will start almost as early
as possible and invoke blkdeactivate.
This can make devices and the filesystems on them unavailable that will
still be needed by other parts of the shutdown.

Usually such services needing the local filesystem will have declared
  After=local-fs.target
And expect to be shut down before things are unmounted.

But blkdeactivate might unmount things before all of that.
To guarantee no devices / filesystems going away too early let us
declare for blk_availability:
  Before=local-fs.target

On shutdown that ensures that blkdeactivate will only be ordered after
local-fs.target which seems what users would expect.

Fixes: lvmteam#18

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
@prajnoha
Copy link
Member

Yes, this is an issue, it's already reported here as well: https://bugzilla.redhat.com/show_bug.cgi?id=1701234.

The problem here is, that some other services which blk-availability orders itself to can contain After=local-fs.target, including all the recursive dependencies (e.g. some service in the dependency chain may require the local filesystems to be mounted to read the configuration for the service to start). Hence we'd get into an ordering loop then and one of the services would be shot down by systemd.

So the fix here is more broader and we probably need to come with new (systemd) targets and maybe split the blk-availability.service in two so we can still properly order it properly with respect to other services.

@cpaelzer
Copy link
Author

Interesting, thanks for the details - subscribing there to stay up to date what happens.

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