Merge release-20200608.0-93-gf40d023ad (automated)

This commit is contained in:
gVisor bot 2020-06-19 15:48:16 +00:00
commit 8f2d48b38b
2 changed files with 5 additions and 4 deletions

View File

@ -124,7 +124,7 @@ func (s *Statx) UnmarshalBytes(src []byte) {
// Packed implements marshal.Marshallable.Packed. // Packed implements marshal.Marshallable.Packed.
//go:nosplit //go:nosplit
func (s *Statx) Packed() bool { func (s *Statx) Packed() bool {
return s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() && s.Atime.Packed() return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed()
} }
// MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
@ -178,7 +178,7 @@ func (s *Statx) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
// CopyIn implements marshal.Marshallable.CopyIn. // CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit //go:nosplit
func (s *Statx) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) { func (s *Statx) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
if !s.Mtime.Packed() && s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() { if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() {
// Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes.
buf := task.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. buf := task.CopyScratchBuffer(s.SizeBytes()) // escapes: okay.
length, err := task.CopyInBytes(addr, buf) // escapes: okay. length, err := task.CopyInBytes(addr, buf) // escapes: okay.
@ -204,7 +204,7 @@ func (s *Statx) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
// WriteTo implements io.WriterTo.WriteTo. // WriteTo implements io.WriterTo.WriteTo.
func (s *Statx) WriteTo(w io.Writer) (int64, error) { func (s *Statx) WriteTo(w io.Writer) (int64, error) {
if !s.Mtime.Packed() && s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() { if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() {
// Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := make([]byte, s.SizeBytes()) buf := make([]byte, s.SizeBytes())
s.MarshalBytes(buf) s.MarshalBytes(buf)

View File

@ -1196,7 +1196,8 @@ func (fs *filesystem) RenameAt(ctx context.Context, rp *vfs.ResolvingPath, oldPa
if newParent.cachedMetadataAuthoritative() { if newParent.cachedMetadataAuthoritative() {
newParent.dirents = nil newParent.dirents = nil
newParent.touchCMtime() newParent.touchCMtime()
if renamed.isDir() { if renamed.isDir() && (replaced == nil || !replaced.isDir()) {
// Increase the link count if we did not replace another directory.
newParent.incLinks() newParent.incLinks()
} }
} }