Commit 3dce6f5d authored by Frederick Akalin's avatar Frederick Akalin

Increment generation on inode reuse

parent 92a4cb63
...@@ -45,6 +45,7 @@ const _ALREADY_MSG = "Object already has a handle" ...@@ -45,6 +45,7 @@ const _ALREADY_MSG = "Object already has a handle"
type portableHandleMap struct { type portableHandleMap struct {
sync.RWMutex sync.RWMutex
generation uint64
used int used int
handles []*handled handles []*handled
freeIds []uint64 freeIds []uint64
...@@ -70,6 +71,7 @@ func (m *portableHandleMap) Register(obj *handled) (handle, generation uint64) { ...@@ -70,6 +71,7 @@ func (m *portableHandleMap) Register(obj *handled) (handle, generation uint64) {
} else { } else {
handle = m.freeIds[len(m.freeIds)-1] handle = m.freeIds[len(m.freeIds)-1]
m.freeIds = m.freeIds[:len(m.freeIds)-1] m.freeIds = m.freeIds[:len(m.freeIds)-1]
m.generation++
m.handles[handle] = obj m.handles[handle] = obj
} }
m.used++ m.used++
...@@ -78,6 +80,7 @@ func (m *portableHandleMap) Register(obj *handled) (handle, generation uint64) { ...@@ -78,6 +80,7 @@ func (m *portableHandleMap) Register(obj *handled) (handle, generation uint64) {
handle = obj.handle handle = obj.handle
} }
obj.count++ obj.count++
generation = m.generation
m.Unlock() m.Unlock()
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment