Skip to content

Commit 268e048

Browse files
committed
Revert most of "fusefrontend: clamp oversized reads"
We cannot return less data than requested to the kernel! From https://libfuse.github.io/doxygen/structfuse__operations.html: Read should return exactly the number of bytes requested except on EOF or error, otherwise the rest of the data will be substituted with zeroes. Reverts commit 3009ec9 minus the formatting improvements we want to keep. Fixes #147 Reopens #145
1 parent b3c20e5 commit 268e048

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

internal/fusefrontend/file.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ func (f *file) createHeader() (fileID []byte, err error) {
132132
return h.ID, err
133133
}
134134

135-
var oversizedReadWarn sync.Once
136-
137135
// doRead - read "length" plaintext bytes from plaintext offset "off" and append
138136
// to "dst".
139137
// Arguments "length" and "off" do not have to be block-aligned.
@@ -144,16 +142,6 @@ var oversizedReadWarn sync.Once
144142
// Called by Read() for normal reading,
145143
// by Write() and Truncate() for Read-Modify-Write
146144
func (f *file) doRead(dst []byte, off uint64, length uint64) ([]byte, fuse.Status) {
147-
// Our byte cache pools are sized acc. to MAX_KERNEL_WRITE, but the
148-
// running kernel may have a higher limit set. Clamp to what we can
149-
// handle.
150-
if length > fuse.MAX_KERNEL_WRITE {
151-
oversizedReadWarn.Do(func() {
152-
tlog.Warn.Printf("doRead: truncating oversized read: %d to %d bytes",
153-
length, fuse.MAX_KERNEL_WRITE)
154-
})
155-
length = fuse.MAX_KERNEL_WRITE
156-
}
157145
// Make sure we have the file ID.
158146
f.fileTableEntry.HeaderLock.RLock()
159147
if f.fileTableEntry.ID == nil {

0 commit comments

Comments
 (0)