From d84db4bbebec5d8c0d0e20dbf9deffdd24ba1151 Mon Sep 17 00:00:00 2001 From: Viktor Kuzmin Date: Sun, 6 Aug 2023 21:19:26 +0300 Subject: Use SIGTERM for shutting down weed mount, adjust timeouts --- pkg/driver/mounter.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkg/driver') diff --git a/pkg/driver/mounter.go b/pkg/driver/mounter.go index 64eae33..2e51314 100644 --- a/pkg/driver/mounter.go +++ b/pkg/driver/mounter.go @@ -96,7 +96,8 @@ func fuseMount(path string, command string, args []string) (Unmounter, error) { func (fu *fuseUnmounter) finish(timeout time.Duration) error { // ignore error, just inform we want process to exit - _ = fu.cmd.Process.Signal(syscall.Signal(1)) + // SIGHUP is used to reload weed config - we need to use SIGTERM + _ = fu.cmd.Process.Signal(syscall.SIGTERM) if err := fu.waitFinished(timeout); err != nil { glog.Errorf("weed mount terminate timeout, pid: %d, path: %v", fu.cmd.Process.Pid, fu.path) @@ -122,11 +123,11 @@ func (fu *fuseUnmounter) waitFinished(timeout time.Duration) error { } func (fu *fuseUnmounter) Unmount() error { - if ok, err := mountutil.IsLikelyNotMountPoint(fu.path); !ok || mount.IsCorruptedMnt(err) { + if ok, err := mountutil.IsMountPoint(fu.path); ok || mount.IsCorruptedMnt(err) { if err := mountutil.Unmount(fu.path); err != nil { return err } } - return fu.finish(time.Second * 30) + return fu.finish(time.Second * 5) } -- cgit v1.2.3