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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user