Ensure weed fuse master process exits after mounted (#6809)

* Ensure fuse master process wait for mounted

* Validate parent PID input in fuse command
This commit is contained in:
Weihao Jiang
2025-05-23 00:50:07 +08:00
committed by GitHub
parent 165af32d6b
commit 874b4a5535
3 changed files with 33 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import (
"runtime"
"strconv"
"strings"
"syscall"
"time"
"github.com/hanwen/go-fuse/v2/fuse"
@@ -268,6 +269,15 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
unmount.Unmount(dir)
})
if mountOptions.fuseCommandPid != 0 {
// send a signal to the parent process to notify that the mount is ready
err = syscall.Kill(mountOptions.fuseCommandPid, syscall.SIGUSR1)
if err != nil {
fmt.Printf("failed to notify parent process: %v\n", err)
return false
}
}
grpcS := pb.NewGrpcServer()
mount_pb.RegisterSeaweedMountServer(grpcS, seaweedFileSystem)
reflection.Register(grpcS)