mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Treat fsync errors during save as SaveRejection errors.
PiperOrigin-RevId: 241055485 Change-Id: I70259e9fef59bdf9733b35a2cd3319359449dd45
This commit is contained in:
committed by
Shentubot
parent
d11ef20a93
commit
e8fef3d873
@@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user