summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/kernel.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-03-29 14:47:16 -0700
committerShentubot <shentubot@google.com>2019-03-29 14:48:16 -0700
commite8fef3d873e4564f0979303d134478b11def8349 (patch)
treee7ec31b5d08dbddce5866f289afe081858af4086 /pkg/sentry/kernel/kernel.go
parentd11ef20a936536aec811aec4e156366c5aeaac47 (diff)
Treat fsync errors during save as SaveRejection errors.
PiperOrigin-RevId: 241055485 Change-Id: I70259e9fef59bdf9733b35a2cd3319359449dd45
Diffstat (limited to 'pkg/sentry/kernel/kernel.go')
-rw-r--r--pkg/sentry/kernel/kernel.go13
1 files changed, 8 insertions, 5 deletions
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),
+ }
}
}
}