From c7a59a99e3fa8d85cac0d638e251438238f18503 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Sun, 1 Mar 2020 17:40:35 -0800 Subject: [PATCH] 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 --- src/os/file_plan9.go | 5 +++++ 1 file changed, 5 insertions(+) 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) } -- 2.50.0