Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Avoid concurrent LVM CLI invocations #103

Merged
merged 8 commits into from
Aug 9, 2019

Conversation

gpaul
Copy link
Contributor

@gpaul gpaul commented Aug 8, 2019

The lvm2 project has issues with locking when multiple LVM command-line utilities execute concurrently.

See

This PR introduces a lock to csilvm that prevents multiple csilvm threads or processes from executing any LVM2 command-line utility while another is in progress.

All csilvm processes (that include this patch) must hold the new lock while performing command-line invocations.

The lock is disabled by default, as it is not possible to determine a good default file path for the lock file.

To enable the locking behaviour, pass the -lockfile= option to the absolute path of the lock file, e.g., -lockfile=/run/csilvm.lock.

Fixes https://jira.mesosphere.com/browse/DCOS_OSS-5434

Gustav Paul added 3 commits August 8, 2019 16:03
This option specifies the path to a lock file to use
for serializing command-line invocations of lvm utilities
across all csilvm instances running on the same agent.
@gpaul gpaul changed the title Avoid concurrent LVM CLI invocations [WIP] Avoid concurrent LVM CLI invocations Aug 8, 2019
@gpaul gpaul changed the title [WIP] Avoid concurrent LVM CLI invocations Avoid concurrent LVM CLI invocations Aug 8, 2019
@gpaul gpaul requested review from chhsia0, bbannier and nfnt August 8, 2019 14:21
Copy link

@bbannier bbannier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. I left a few inconsequential comments.

Can you explain the reasoning behind not always requiring locking? Is this needed for some migration path?

@gpaul
Copy link
Contributor Author

gpaul commented Aug 9, 2019

Good points. I now enable locking by default, added some explanatory comments to the code, and added some sanity checking in the form of an initial Lock/Unlock cycle when setting the lockfile.

@gpaul gpaul merged commit 248f7a6 into master Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants