From a8486f070a15fa2d2958486953d87c1725ce3925 Mon Sep 17 00:00:00 2001 From: Aaron Prindle Date: Fri, 16 Jun 2017 23:53:00 -0700 Subject: [PATCH] Fixed issue where mount through an error on large folders --- third_party/go9p/ufs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/third_party/go9p/ufs.go b/third_party/go9p/ufs.go index 4047bb3d41d7..a5e5a05f78d7 100644 --- a/third_party/go9p/ufs.go +++ b/third_party/go9p/ufs.go @@ -369,18 +369,20 @@ func (*Ufs) Read(req *SrvReq) { count = len(fid.dirents[tc.Offset:]) } + wasExact := false if !*Akaros { nextend := sort.SearchInts(fid.direntends, int(tc.Offset)+count) if nextend < len(fid.direntends) { if fid.direntends[nextend] > int(tc.Offset)+count { if nextend > 0 { count = fid.direntends[nextend-1] - int(tc.Offset) + wasExact = true } else { count = 0 } } } - if count == 0 && int(tc.Offset) < len(fid.dirents) && len(fid.dirents) > 0 { + if !wasExact && count == 0 && int(tc.Offset) < len(fid.dirents) && len(fid.dirents) > 0 { req.RespondError(&Error{"too small read size for dir entry", EINVAL}) return }