Fix lisafs bug which tramples dentry UID on remote revalidation.

PiperOrigin-RevId: 414483232
This commit is contained in:
Ayush Ranjan
2021-12-06 10:35:24 -08:00
committed by gVisor bot
parent 3f2ffc9f0c
commit d62190f8b5
2 changed files with 1 additions and 4 deletions
+1 -1
View File
@@ -1173,7 +1173,7 @@ func (d *dentry) updateFromLisaStatLocked(stat *linux.Statx) {
atomic.StoreUint32(&d.uid, dentryUIDFromLisaUID(lisafs.UID(stat.UID)))
}
if stat.Mask&linux.STATX_GID != 0 {
atomic.StoreUint32(&d.uid, dentryGIDFromLisaGID(lisafs.GID(stat.GID)))
atomic.StoreUint32(&d.gid, dentryGIDFromLisaGID(lisafs.GID(stat.GID)))
}
if stat.Blksize != 0 {
atomic.StoreUint32(&d.blockSize, stat.Blksize)
-3
View File
@@ -476,14 +476,12 @@ func (fd *controlFDLisa) OpenCreate(c *lisafs.Connection, comm lisafs.Communicat
// Set the owners as requested by the client.
if err := unix.Fchownat(childFD.hostFD, "", int(uid), int(gid), unix.AT_EMPTY_PATH|unix.AT_SYMLINK_NOFOLLOW); err != nil {
log.Infof("ayush: Fchownat %v", err)
return err
}
// Do not use the stat result from tryOpen because the owners might have
// changed. initInode() will stat the FD again and use fresh results.
if err := childFD.initInode(&resp.Child); err != nil {
log.Infof("ayush: initInode %v", err)
return err
}
@@ -491,7 +489,6 @@ func (fd *controlFDLisa) OpenCreate(c *lisafs.Connection, comm lisafs.Communicat
flags |= openFlags
newHostFD, err := unix.Openat(int(procSelfFD.FD()), strconv.Itoa(childFD.hostFD), int(flags)&^unix.O_NOFOLLOW, 0)
if err != nil {
log.Infof("ayush: Openat %v", err)
return err
}
cu.Release()