Skip to content

Commit b6f6765

Browse files
committed
incus-agent: Retry mounts to avoid kernel races
Closes #1881 Signed-off-by: Stéphane Graber <[email protected]>
1 parent 2dd348e commit b6f6765

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmd/incus-agent/events.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"net/http"
77
"strings"
8+
"time"
89

910
"github.com/lxc/incus/v6/internal/server/events"
1011
"github.com/lxc/incus/v6/internal/server/response"
@@ -147,7 +148,15 @@ func eventsProcess(event api.Event) {
147148
// Attempt to perform the mount.
148149
mntSource := fmt.Sprintf("incus_%s", e.Name)
149150

150-
err = tryMountShared(mntSource, e.Config["path"], "virtiofs", nil)
151+
for i := 0; i < 20; i++ {
152+
time.Sleep(500*time.Millisecond)
153+
154+
err = tryMountShared(mntSource, e.Config["path"], "virtiofs", nil)
155+
if err == nil {
156+
break
157+
}
158+
}
159+
151160
if err != nil {
152161
logger.Infof("Failed to mount hotplug %q (Type: %q) to %q", mntSource, "virtiofs", e.Config["path"])
153162
return

0 commit comments

Comments
 (0)