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 <khr@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
This commit is contained in:
Keith Randall 2020-03-01 17:40:35 -08:00
parent 4978f5e6ea
commit c7a59a99e3

View File

@ -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)
}