From 8d10a3182ef56bea8a8cb10b086be93d408ee593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Sun, 28 Sep 2025 17:09:12 +0800 Subject: feat: add log --- pkg/mountmanager/manager.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'pkg') diff --git a/pkg/mountmanager/manager.go b/pkg/mountmanager/manager.go index 420300e..19662f3 100644 --- a/pkg/mountmanager/manager.go +++ b/pkg/mountmanager/manager.go @@ -58,7 +58,7 @@ func (m *Manager) Mount(req *MountRequest) (*MountResponse, error) { if entry := m.getMount(req.VolumeID); entry != nil { if entry.targetPath == req.TargetPath { - glog.V(1).Infof("volume %s already mounted at %s", req.VolumeID, req.TargetPath) + glog.Infof("volume %s already mounted at %s", req.VolumeID, req.TargetPath) return &MountResponse{LocalSocket: entry.localSocket}, nil } return nil, fmt.Errorf("volume %s already mounted at %s", req.VolumeID, entry.targetPath) @@ -73,8 +73,7 @@ func (m *Manager) Mount(req *MountRequest) (*MountResponse, error) { m.mounts[req.VolumeID] = entry m.mu.Unlock() - go m.watchMount(req.VolumeID, entry) - + glog.Infof("started weed mount process for volume %s at %s", req.VolumeID, req.TargetPath) return &MountResponse{LocalSocket: entry.localSocket}, nil } @@ -93,7 +92,7 @@ func (m *Manager) Unmount(req *UnmountRequest) (*UnmountResponse, error) { entry := m.removeMount(req.VolumeID) if entry == nil { - glog.V(1).Infof("volume %s not mounted", req.VolumeID) + glog.Infof("volume %s not mounted", req.VolumeID) return &UnmountResponse{}, nil } @@ -109,6 +108,7 @@ func (m *Manager) Unmount(req *UnmountRequest) (*UnmountResponse, error) { return nil, err } + glog.Infof("stopped weed mount process for volume %s at %s", req.VolumeID, entry.targetPath) return &UnmountResponse{}, nil } @@ -127,17 +127,6 @@ func (m *Manager) removeMount(volumeID string) *mountEntry { return entry } -func (m *Manager) watchMount(volumeID string, entry *mountEntry) { - <-entry.process.done - m.mu.Lock() - current, ok := m.mounts[volumeID] - if ok && current == entry { - delete(m.mounts, volumeID) - } - m.mu.Unlock() - os.RemoveAll(entry.cacheDir) -} - func (m *Manager) startMount(req *MountRequest) (*mountEntry, error) { targetPath := req.TargetPath if err := ensureTargetClean(targetPath); err != nil { -- cgit v1.2.3