Commit 1e2d4aba authored by Aaron Jacobs's avatar Aaron Jacobs

Don't send error responses to the kernel for forget and interrupt.

It's not expecting them.
parent d205df31
......@@ -423,6 +423,18 @@ func (c *Connection) kernelResponse(
h := m.OutHeader()
h.Unique = fuseID
// Special case: handle the ops for which the kernel expects no response.
// interruptOp .
switch op.(type) {
case *fuseops.ForgetInodeOp:
noResponse = true
return
case *interruptOp:
noResponse = true
return
}
// If the user returned the error, fill in the error field of the outgoing
// message header.
if opErr != nil {
......@@ -441,7 +453,7 @@ func (c *Connection) kernelResponse(
// Otherwise, fill in the rest of the response.
if opErr == nil {
noResponse = c.kernelResponseForOp(m, op)
c.kernelResponseForOp(m, op)
}
h.Len = uint32(m.Len())
......@@ -452,7 +464,7 @@ func (c *Connection) kernelResponse(
// op.
func (c *Connection) kernelResponseForOp(
m *buffer.OutMessage,
op interface{}) (noResponse bool) {
op interface{}) {
// Create the appropriate output message
switch o := op.(type) {
case *fuseops.LookUpInodeOp:
......@@ -474,9 +486,6 @@ func (c *Connection) kernelResponseForOp(
o.AttributesExpiration)
convertAttributes(o.Inode, &o.Attributes, &out.Attr)
case *fuseops.ForgetInodeOp:
noResponse = true
case *fuseops.MkDirOp:
size := fusekernel.EntryOutSize(c.protocol)
out := (*fusekernel.EntryOut)(m.Grow(size))
......@@ -551,9 +560,6 @@ func (c *Connection) kernelResponseForOp(
case *statFSOp:
m.Grow(unsafe.Sizeof(fusekernel.StatfsOut{}))
case *interruptOp:
noResponse = true
case *initOp:
out := (*fusekernel.InitOut)(m.Grow(unsafe.Sizeof(fusekernel.InitOut{})))
......@@ -564,7 +570,7 @@ func (c *Connection) kernelResponseForOp(
out.MaxWrite = o.MaxWrite
default:
panic(fmt.Sprintf("Unknown op: %#v", op))
panic(fmt.Sprintf("Unexpected op: %#v", op))
}
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment