From 70ad54f12e2e1bbf0a841b2604f150464fab1e8f Mon Sep 17 00:00:00 2001 From: chrislusf Date: Sat, 6 Dec 2025 12:02:18 -0800 Subject: fix: address PR review comments - Set localSocket in rebuildVolumeFromStaging to fix invalid gRPC target - Use SHA256 hash (16 hex chars) in LocalSocketPath to minimize collision risk - Update GitHub Actions to latest versions (checkout@v4, metadata-action@v5, etc.) - Fix volumeMounts/volumes conditional mismatch in helm templates - Add documentation for mountService defaults in values.yaml --- pkg/mountmanager/socket.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'pkg/mountmanager/socket.go') diff --git a/pkg/mountmanager/socket.go b/pkg/mountmanager/socket.go index f327dcb..95d63c0 100644 --- a/pkg/mountmanager/socket.go +++ b/pkg/mountmanager/socket.go @@ -1,10 +1,10 @@ package mountmanager import ( + "crypto/sha256" + "encoding/hex" "fmt" "path/filepath" - - "github.com/seaweedfs/seaweedfs/weed/util" ) // DefaultSocketDir is the default directory for volume sockets. @@ -12,13 +12,12 @@ const DefaultSocketDir = "/var/lib/seaweedfs-mount" // LocalSocketPath returns the unix socket path used to communicate with the weed mount process. // The baseDir parameter should be the directory where sockets are stored (e.g., derived from mountEndpoint). +// Uses SHA256 hash (first 16 hex chars = 64 bits) to minimize collision risk. func LocalSocketPath(baseDir, volumeID string) string { if baseDir == "" { baseDir = DefaultSocketDir } - hash := util.HashToInt32([]byte(volumeID)) - if hash < 0 { - hash = -hash - } - return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%d.sock", hash)) + h := sha256.Sum256([]byte(volumeID)) + hashStr := hex.EncodeToString(h[:8]) // 16 hex chars = 64 bits + return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%s.sock", hashStr)) } -- cgit v1.2.3