Commit 52b69de8 authored by Łukasz Magiera's avatar Łukasz Magiera

Add locks to maintenance methods is syncds

parent 73c601d8
......@@ -117,6 +117,8 @@ func (b *syncBatch) Commit() error {
func (d *MutexDatastore) Check() error {
if c, ok := d.child.(ds.CheckedDatastore); ok {
d.RWMutex.Lock()
defer d.RWMutex.Unlock()
return c.Check()
}
return nil
......@@ -124,6 +126,8 @@ func (d *MutexDatastore) Check() error {
func (d *MutexDatastore) Scrub() error {
if c, ok := d.child.(ds.ScrubbedDatastore); ok {
d.RWMutex.Lock()
defer d.RWMutex.Unlock()
return c.Scrub()
}
return nil
......@@ -131,6 +135,8 @@ func (d *MutexDatastore) Scrub() error {
func (d *MutexDatastore) CollectGarbage() error {
if c, ok := d.child.(ds.GCDatastore); ok {
d.RWMutex.Lock()
defer d.RWMutex.Unlock()
return c.CollectGarbage()
}
return nil
......
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