This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/lvm: serialize lvm invocations using lock file
- Loading branch information
Gustav Paul
committed
Aug 8, 2019
1 parent
ba76dce
commit b326cef
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -850,6 +850,10 @@ func LookupPhysicalVolume(name string) (*PhysicalVolume, error) { | |
// https://github.com/Jajcus/lvm2/blob/266d6564d7a72fcff5b25367b7a95424ccf8089e/lib/metadata/metadata.c#L983 | ||
|
||
func run(cmd string, v interface{}, extraArgs ...string) error { | ||
if lvmlock != nil { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
lvmlock.Lock() | ||
This comment has been minimized.
Sorry, something went wrong.
bbannier
|
||
defer lvmlock.Unlock() | ||
} | ||
var args []string | ||
if v != nil { | ||
args = append(args, "--reportformat=json") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do we need this check? Looks like the locking library already short-circuits if we already hold the lock, https://godoc.org/github.com/gofrs/flock#Flock.Lock.