Skip to content

Commit c902e72

Browse files
authored
Merge pull request #4924 from sahitya-chandra/fix-4153-inotify-spam
hostagent: wait for the guest agent before opening the inotify stream
2 parents d62b42a + 30837c0 commit c902e72

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pkg/hostagent/inotify.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ func (a *HostAgent) startInotify(ctx context.Context) error {
3535
// goroutine; without notify.Stop they leak for the lifetime of the process.
3636
defer notify.Stop(mountWatchCh)
3737

38+
// PostInotify returns a usable stream wrapper before the server-side
39+
// handler is installed, so Sends issued during the gap fail with EOF.
40+
select {
41+
case <-a.guestAgentAliveCh:
42+
case <-ctx.Done():
43+
return nil
44+
}
45+
3846
client, err := a.getOrCreateClient(ctx)
3947
if err != nil {
4048
return fmt.Errorf("inotify: failed to obtain guest agent client: %w", err)

0 commit comments

Comments
 (0)