mirror of
https://github.com/moby/buildkit.git
synced 2026-11-06 05:16:45 +00:00
snapshot: prevent duplicate calls to mount returning different values
In addition to being wasteful, without this, concurrent calls to `Mount` would have lost the previous `target` and so would never have been removed. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
1 parent
877093a05a
commit
4b7016b89f
4 files changed
+16
No files matched your search
@@ -13,6 +13,10 @@ func (lm *localMounter) Mount() (string, error) {
|
||||
lm.mu.Lock()
|
||||
defer lm.mu.Unlock()
|
||||
|
||||
if lm.target != "" {
|
||||
return lm.target, nil
|
||||
}
|
||||
|
||||
if lm.mounts == nil && lm.mountable != nil {
|
||||
mounts, release, err := lm.mountable.Mount()
|
||||
if err != nil {
|
||||
|
||||
@@ -12,6 +12,10 @@ func (lm *localMounter) Mount() (string, error) {
|
||||
lm.mu.Lock()
|
||||
defer lm.mu.Unlock()
|
||||
|
||||
if lm.target != "" {
|
||||
return lm.target, nil
|
||||
}
|
||||
|
||||
if lm.mounts == nil && lm.mountable != nil {
|
||||
mounts, release, err := lm.mountable.Mount()
|
||||
if err != nil {
|
||||
|
||||
@@ -16,6 +16,10 @@ func (lm *localMounter) Mount() (string, error) {
|
||||
lm.mu.Lock()
|
||||
defer lm.mu.Unlock()
|
||||
|
||||
if lm.target != "" {
|
||||
return lm.target, nil
|
||||
}
|
||||
|
||||
if lm.mounts == nil && lm.mountable != nil {
|
||||
mounts, release, err := lm.mountable.Mount()
|
||||
if err != nil {
|
||||
|
||||
@@ -16,6 +16,10 @@ func (lm *localMounter) Mount() (string, error) {
|
||||
lm.mu.Lock()
|
||||
defer lm.mu.Unlock()
|
||||
|
||||
if lm.target != "" {
|
||||
return lm.target, nil
|
||||
}
|
||||
|
||||
if lm.mounts == nil && lm.mountable != nil {
|
||||
mounts, release, err := lm.mountable.Mount()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user