diff options
author | Zhaozhong Ni <nzz@google.com> | 2018-05-08 11:36:11 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-05-08 11:36:59 -0700 |
commit | 174161013de22be6a42b02ee06611a9de9e20b18 (patch) | |
tree | b910f76ea3ba8b14a29df2d28010fd0af1db18bb /pkg/sentry/fs/gofer/file_state.go | |
parent | 3ac3ea1d6afea0b128112e6a46b8bf47b4b0e02a (diff) |
Capture restore file system corruption errors in exit error.
PiperOrigin-RevId: 195850822
Change-Id: I4d7bdd8fe129c5ed461b73e1d7458be2cf5680c2
Diffstat (limited to 'pkg/sentry/fs/gofer/file_state.go')
-rw-r--r-- | pkg/sentry/fs/gofer/file_state.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/sentry/fs/gofer/file_state.go b/pkg/sentry/fs/gofer/file_state.go index 1d63e33ec..715af8f16 100644 --- a/pkg/sentry/fs/gofer/file_state.go +++ b/pkg/sentry/fs/gofer/file_state.go @@ -15,13 +15,15 @@ package gofer import ( + "fmt" + "gvisor.googlesource.com/gvisor/pkg/sentry/context" "gvisor.googlesource.com/gvisor/pkg/sentry/fs" ) // afterLoad is invoked by stateify. func (f *fileOperations) afterLoad() { - load := func() { + load := func() error { f.inodeOperations.fileState.waitForLoad() // Manually load the open handles. @@ -29,9 +31,10 @@ func (f *fileOperations) afterLoad() { // TODO: Context is not plumbed to save/restore. f.handles, err = newHandles(context.Background(), f.inodeOperations.fileState.file, f.flags) if err != nil { - panic("failed to re-open handle: " + err.Error()) + return fmt.Errorf("failed to re-open handle: %v", err) } f.inodeOperations.fileState.setHandlesForCachedIO(f.flags, f.handles) + return nil } - fs.Async(load) + fs.Async(fs.CatchError(load)) } |