From e8fef3d873e4564f0979303d134478b11def8349 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Fri, 29 Mar 2019 14:47:16 -0700 Subject: Treat fsync errors during save as SaveRejection errors. PiperOrigin-RevId: 241055485 Change-Id: I70259e9fef59bdf9733b35a2cd3319359449dd45 --- pkg/sentry/kernel/kernel.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pkg') diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go index d9f3f4e24..f5cbd6c23 100644 --- a/pkg/sentry/kernel/kernel.go +++ b/pkg/sentry/kernel/kernel.go @@ -365,12 +365,15 @@ func (ts *TaskSet) flushWritesToFiles(ctx context.Context) error { syncErr := desc.file.Fsync(ctx, 0, fs.FileMaxOffset, fs.SyncAll) if err := fs.SaveFileFsyncError(syncErr); err != nil { name, _ := desc.file.Dirent.FullName(nil /* root */) - // Wrapping this error not only allows - // for a more useful message, but is - // required to distinguish Fsync errors - // from state file errors in + // Wrap this error in ErrSaveRejection + // so that it will trigger a save + // error, rather than a panic. This + // also allows us to distinguish Fsync + // errors from state file errors in // state.Save. - return fmt.Errorf("%q was not sufficiently synced: %v", name, err) + return fs.ErrSaveRejection{ + Err: fmt.Errorf("%q was not sufficiently synced: %v", name, err), + } } } } -- cgit v1.2.3