diff --git a/cmd/stargz-fuse-manager/fusemanager/fusemanager.go b/cmd/stargz-fuse-manager/fusemanager/fusemanager.go index 8ae870467..31a3542c6 100644 --- a/cmd/stargz-fuse-manager/fusemanager/fusemanager.go +++ b/cmd/stargz-fuse-manager/fusemanager/fusemanager.go @@ -221,6 +221,7 @@ func runFuseManager(ctx context.Context) error { sig := <-sigCh log.G(ctx).Infof("Got %v", sig) fm.server.Stop() + os.Remove(address) }() if err = server.Serve(l); err != nil { diff --git a/cmd/stargz-fuse-manager/fusemanager/service.go b/cmd/stargz-fuse-manager/fusemanager/service.go index efd9dc706..9c8fc145a 100644 --- a/cmd/stargz-fuse-manager/fusemanager/service.go +++ b/cmd/stargz-fuse-manager/fusemanager/service.go @@ -72,6 +72,8 @@ type Server struct { // curFs is filesystem created by latest config curFs snapshot.FileSystem ms *bolt.DB + + fuseStoreAddr string } func NewFuseManager(ctx context.Context, listener net.Listener, server *grpc.Server, fuseStoreAddr string) (*Server, error) { @@ -91,6 +93,7 @@ func NewFuseManager(ctx context.Context, listener net.Listener, server *grpc.Ser ms: db, listener: listener, server: server, + fuseStoreAddr: fuseStoreAddr, } return fm, nil @@ -278,6 +281,11 @@ func (fm *Server) Close(ctx context.Context) error { return err } + if err := os.Remove(fm.fuseStoreAddr); err != nil { + log.G(ctx).WithError(err).Errorf("failed to remove fusestore file %s", fm.fuseStoreAddr) + return err + } + return nil }