Skip to content

Commit

Permalink
Handling error during initOp response to kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
raj-prince committed Oct 3, 2023
1 parent ab21db1 commit de9b9ed
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ func (c *Connection) Init() error {
initOp.Flags |= fusekernel.InitNoOpendirSupport
}

c.Reply(ctx, nil)
return nil
return c.Reply(ctx, nil)
}

// Log information for an operation with the given ID. calldepth is the depth
Expand Down Expand Up @@ -471,7 +470,7 @@ func (c *Connection) shouldLogError(
// (or nil if successful). The context must be the context returned by ReadOp.
//
// LOCKS_EXCLUDED(c.mu)
func (c *Connection) Reply(ctx context.Context, opErr error) {
func (c *Connection) Reply(ctx context.Context, opErr error) error {
// Extract the state we stuffed in earlier.
var key interface{} = contextKey
foo := ctx.Value(key)
Expand Down Expand Up @@ -516,11 +515,16 @@ func (c *Connection) Reply(ctx context.Context, opErr error) {
} else {
err = c.writeMessage(outMsg.OutHeaderBytes())
}
if err != nil && c.errorLogger != nil {
c.errorLogger.Printf("writeMessage: %v %v", err, outMsg.OutHeaderBytes())
if err != nil {
if c.errorLogger != nil {
c.errorLogger.Printf("writeMessage: %v %v", err, outMsg.OutHeaderBytes())
}
return fmt.Errorf("writeMessage: %v %v", err, outMsg.OutHeaderBytes())
}
outMsg.Sglist = nil
}

return nil
}

// Close the connection. Must not be called until operations that were read
Expand Down

0 comments on commit de9b9ed

Please sign in to comment.