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:
Justin Chadwell committed 2025-12-04 11:33:42 +00:00
1 parent 877093a05a
commit 4b7016b89f
4 files changed
+16

No files matched your search

+4
View File
@@ -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 {
+4
View File
@@ -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 {
+4
View File
@@ -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 {
+4
View File
@@ -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 {