Skip to content

Commit de7fafd

Browse files
committed
commands: daemon - simplify stop sequence
Currently, the unmount phase waits for the server shutdown phase to return. We do this to assure that connected clients don't instantiate new mountpoints while the unmount phase is processing or after it has already returned. It's possible for these to be more independent, but since they depend on sequential operation, we can drop a WaitGroup and a goroutine for now.
1 parent 8ced2c5 commit de7fafd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

internal/commands/daemon.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,21 +349,15 @@ func handleStopSequence(ctx context.Context,
349349
mount mountSubsystem, mntStop <-chan shutdownDisposition,
350350
errs wgErrs, log ulog.Logger,
351351
) *sync.WaitGroup {
352-
var serverWg,
353-
mountWg sync.WaitGroup
354352
errs.Add(2)
355-
serverWg.Add(1)
356-
mountWg.Add(1)
353+
var serviceWg sync.WaitGroup
354+
serviceWg.Add(1)
357355
go func() {
358-
defer serverWg.Done()
356+
defer serviceWg.Done()
359357
serverStopper(ctx, server, srvStop, errs, log)
360-
}()
361-
go func() {
362-
serverWg.Wait()
363358
unmountAll(mount, mntStop, errs, log)
364-
mountWg.Done()
365359
}()
366-
return &mountWg
360+
return &serviceWg
367361
}
368362

369363
func listenOn(listener *p9fs.Listener, permissions p9.FileMode,

0 commit comments

Comments
 (0)