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

It's not expecting them.
geesefs-0-30-9
Aaron Jacobs 2015-08-04 12:28:08 +10:00
parent d205df3144
commit 1e2d4abaf9
1 changed files with 15 additions and 9 deletions

View File

@ -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