Fix data race caused by unlocked call of Dirent.descendantOf.
PiperOrigin-RevId: 224025363 Change-Id: I98864403c779832e9e1436f7d3c3f6fb2fba9904
This commit is contained in:
parent
c3dd68cea7
commit
54dd0d0dc5
|
@ -840,6 +840,10 @@ func (d *Dirent) getDotAttrs(root *Dirent) (DentAttr, DentAttr) {
|
||||||
InodeID: sattr.InodeID,
|
InodeID: sattr.InodeID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hold d.mu while we call d.descendantOf.
|
||||||
|
d.mu.Lock()
|
||||||
|
defer d.mu.Unlock()
|
||||||
|
|
||||||
// Get '..'.
|
// Get '..'.
|
||||||
if !d.IsRoot() && d.descendantOf(root) {
|
if !d.IsRoot() && d.descendantOf(root) {
|
||||||
// Dirent is a descendant of the root. Get its parent's attrs.
|
// Dirent is a descendant of the root. Get its parent's attrs.
|
||||||
|
|
Loading…
Reference in New Issue