From 174161013de22be6a42b02ee06611a9de9e20b18 Mon Sep 17 00:00:00 2001 From: Zhaozhong Ni Date: Tue, 8 May 2018 11:36:11 -0700 Subject: Capture restore file system corruption errors in exit error. PiperOrigin-RevId: 195850822 Change-Id: I4d7bdd8fe129c5ed461b73e1d7458be2cf5680c2 --- pkg/sentry/fs/fdpipe/pipe_state.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkg/sentry/fs/fdpipe') diff --git a/pkg/sentry/fs/fdpipe/pipe_state.go b/pkg/sentry/fs/fdpipe/pipe_state.go index 8996a2178..99c40d8ed 100644 --- a/pkg/sentry/fs/fdpipe/pipe_state.go +++ b/pkg/sentry/fs/fdpipe/pipe_state.go @@ -63,7 +63,7 @@ func (p *pipeOperations) loadFlags(flags fs.FileFlags) { // afterLoad is invoked by stateify. func (p *pipeOperations) afterLoad() { - load := func() { + load := func() error { if !p.flags.Read { readPipeOperationsLoading.Wait() } else { @@ -75,14 +75,15 @@ func (p *pipeOperations) afterLoad() { Write: p.flags.Write, }) if err != nil { - panic(fmt.Sprintf("unable to open pipe %v: %v", p, err)) + return fmt.Errorf("unable to open pipe %v: %v", p, err) } if err := p.init(); err != nil { - panic(fmt.Sprintf("unable to initialize pipe %v: %v", p, err)) + return fmt.Errorf("unable to initialize pipe %v: %v", p, err) } + return nil } // Do background opening of pipe ends. Note for write-only pipe ends we // have to do it asynchronously to avoid blocking the restore. - fs.Async(load) + fs.Async(fs.CatchError(load)) } -- cgit v1.2.3