randomizing next file handle id

This commit is contained in:
chrislu
2024-08-07 10:41:58 -07:00
parent 3e6ca6e706
commit 57dc39c451
3 changed files with 11 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/mount/meta_cache"
"github.com/seaweedfs/seaweedfs/weed/util"
"math"
"sync"
)
@@ -45,7 +46,7 @@ func NewDirectoryHandleToInode() *DirectoryHandleToInode {
func (wfs *WFS) AcquireDirectoryHandle() (DirectoryHandleId, *DirectoryHandle) {
wfs.fhmap.Lock()
fh := wfs.fhmap.nextFh
wfs.fhmap.nextFh++
wfs.fhmap.nextFh = FileHandleId(util.RandomUint64())
wfs.fhmap.Unlock()
wfs.dhmap.Lock()