From 5c37097e34a513845d77bb8b7240f0074aa1c1e9 Mon Sep 17 00:00:00 2001 From: Brian Geffon Date: Thu, 7 Jun 2018 15:09:27 -0700 Subject: rpcinet should not block in read(2) rpcs. PiperOrigin-RevId: 199703609 Change-Id: I8153b0396b22a230a68d4b69c46652a5545f7630 --- pkg/sentry/socket/rpcinet/socket.go | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'pkg/sentry/socket/rpcinet') diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go index 29546b683..69cf604b7 100644 --- a/pkg/sentry/socket/rpcinet/socket.go +++ b/pkg/sentry/socket/rpcinet/socket.go @@ -145,29 +145,8 @@ func (s *socketOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOS n, e := dst.CopyOut(ctx, res.Data) return int64(n), e } - if se != syserr.ErrWouldBlock { - return 0, se.ToError() - } - - // We'll have to block. Register for notifications and read again when ready. - e, ch := waiter.NewChannelEntry(nil) - s.EventRegister(&e, waiter.EventIn) - defer s.EventUnregister(&e) - for { - res, se := rpcRead(ctx.(*kernel.Task), req) - if se == nil { - n, e := dst.CopyOut(ctx, res.Data) - return int64(n), e - } - if se != syserr.ErrWouldBlock { - return 0, se.ToError() - } - - if err := ctx.(*kernel.Task).Block(ch); err != nil { - return 0, err - } - } + return 0, se.ToError() } func rpcWrite(t *kernel.Task, req *pb.SyscallRequest_Write) (uint32, *syserr.Error) { -- cgit v1.2.3