From: Keith Randall Date: Mon, 2 Mar 2020 01:40:35 +0000 (-0800) Subject: os: plan9 seek() should invalidate cached directory info X-Git-Tag: go1.15beta1~977 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c7a59a99e3fa8d85cac0d638e251438238f18503;p=gostls13.git os: plan9 seek() should invalidate cached directory info Update #37161 Change-Id: Iee828bbcc8436af29ca6dd9ed897cb5265a57cf8 Reviewed-on: https://go-review.googlesource.com/c/go/+/221778 Run-TryBot: Keith Randall Reviewed-by: Emmanuel Odeke --- diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go index 48bf5f5076..bcf3c625bf 100644 --- a/src/os/file_plan9.go +++ b/src/os/file_plan9.go @@ -290,6 +290,11 @@ func (f *File) pwrite(b []byte, off int64) (n int, err error) { // relative to the current offset, and 2 means relative to the end. // It returns the new offset and an error, if any. func (f *File) seek(offset int64, whence int) (ret int64, err error) { + if f.dirinfo != nil { + // Free cached dirinfo, so we allocate a new one if we + // access this file as a directory again. See #35767 and #37161. + f.dirinfo = nil + } return syscall.Seek(f.fd, offset, whence) }