diff options
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)) } |