vfs: fix data race discovered by the race detector
This fixes a place where we read from item.o without the item.mu held.
This commit is contained in:
parent
25d5ed763c
commit
687a3b1832
1 changed files with 2 additions and 1 deletions
|
@ -605,8 +605,9 @@ func (item *Item) _store(ctx context.Context, storeFn StoreFn) (err error) {
|
||||||
fs.Debugf(item.name, "vfs cache: writeback object to VFS layer")
|
fs.Debugf(item.name, "vfs cache: writeback object to VFS layer")
|
||||||
// Write the object back to the VFS layer as last
|
// Write the object back to the VFS layer as last
|
||||||
// thing we do with mutex unlocked
|
// thing we do with mutex unlocked
|
||||||
|
o := item.o
|
||||||
item.mu.Unlock()
|
item.mu.Unlock()
|
||||||
storeFn(item.o)
|
storeFn(o)
|
||||||
item.mu.Lock()
|
item.mu.Lock()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue