Skip to content

Commit

Permalink
fuse: do not serialize headers until after adjustment
Browse files Browse the repository at this point in the history
Older kernel versions do not support all the fields of the current INIT header.
Adjust the header size before marshaling the header payload.

Updates #538
  • Loading branch information
creachadair committed Oct 26, 2024
1 parent be2966e commit 3b9d8d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fuse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,14 @@ func (ms *Server) write(req *request) Status {
return OK
}
}
req.serializeHeader(req.outPayloadSize())

// Adjust header length for the INIT opcode on older versions, prior to
// serializing.
if req.inHeader().Opcode == _OP_INIT && ms.kernelSettings.Minor <= 22 {
// v8-v22 don't have TimeGran and further fields.
req.outHeader().Length = uint32(sizeOfOutHeader) + 24
}
req.serializeHeader(req.outPayloadSize())

if ms.opts.Debug {
ms.opts.Logger.Println(req.OutputDebug())
Expand Down

0 comments on commit 3b9d8d9

Please sign in to comment.