diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-03-22 22:32:47 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-03-22 22:32:47 -0700 |
| commit | 3cbc40fa48689511dbb5a953399218e1a296a874 (patch) | |
| tree | 4d81b0cf78f2b5ac7a8d822620814d767dab2610 | |
| parent | 2f7c7afdec305caf2b1ea029f27b6e1b220ddc2d (diff) | |
| download | seaweedfs-3cbc40fa48689511dbb5a953399218e1a296a874.tar.xz seaweedfs-3cbc40fa48689511dbb5a953399218e1a296a874.zip | |
avoid creating multiple reader
| -rw-r--r-- | weed/filesys/filehandle.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 53c1c23d5..6d72e62ce 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -23,7 +23,7 @@ type FileHandle struct { dirtyPages *ContinuousDirtyPages contentType string handle uint64 - sync.RWMutex + sync.Mutex f *File RequestId fuse.RequestID // unique ID for request @@ -59,8 +59,8 @@ var _ = fs.HandleReleaser(&FileHandle{}) func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error { glog.V(4).Infof("%s read fh %d: [%d,%d) size %d resp.Data cap=%d", fh.f.fullpath(), fh.handle, req.Offset, req.Offset+int64(req.Size), req.Size, cap(resp.Data)) - fh.RLock() - defer fh.RUnlock() + fh.Lock() + defer fh.Unlock() if req.Size <= 0 { return nil |
