Prevent lisafs socket communicator from returning io.EOF when server exits.

This is consistent with what our p9 package does. See
pkg/p9/client.go:sendRecvLegacySyscallErr(). This is also consistent with what
lisafs channel communicator does.

We log the actual error that caused the RPC to fail and map all transport
errors to EIO. Returning io.EOF to the client may cause the sentry to panic if
it tries to convert it into a syscall error in kernel.ExtractErrno().

PiperOrigin-RevId: 495696116
This commit is contained in:
Ayush Ranjan
2022-12-15 14:29:16 -08:00
committed by gVisor bot
parent 5d4c05f0c3
commit 54dafa76c2
2 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ func (ch *channel) SndRcvMessage(m MID, payloadLen uint32, wantFDs uint8) (MID,
// This channel is now unusable.
ch.dead = true
// Map the transport errors to EIO, but also log the real error.
log.Warningf("lisafs.sndRcvMessage: flipcall.Endpoint.SendRecv: %v", err)
log.Warningf("channel.SndRcvMessage: flipcall.Endpoint.SendRecv failed: %v", err)
return 0, 0, unix.EIO
}
+9 -2
View File
@@ -83,11 +83,18 @@ func (s *sockCommunicator) PayloadBuf(size uint32) []byte {
// SndRcvMessage implements Communicator.SndRcvMessage.
func (s *sockCommunicator) SndRcvMessage(m MID, payloadLen uint32, wantFDs uint8) (MID, uint32, error) {
// Map the transport errors to EIO, but also log the real error.
if err := s.sndPrepopulatedMsg(m, payloadLen, nil); err != nil {
return 0, 0, err
log.Warningf("socketCommunicator.SndRcvMessage: sndPrepopulatedMsg failed: %v", err)
return 0, 0, unix.EIO
}
return s.rcvMsg(wantFDs)
respM, respPayloadLen, err := s.rcvMsg(wantFDs)
if err != nil {
log.Warningf("socketCommunicator.SndRcvMessage: rcvMsg failed: %v", err)
return 0, 0, unix.EIO
}
return respM, respPayloadLen, nil
}
// String implements fmt.Stringer.String.