diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2020-03-31 15:00:30 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-31 15:11:11 -0700 |
commit | b6639f77e59d885cb092c15a7a0c5a988e149b40 (patch) | |
tree | 17e31673f34ae507ec7260313f387a2cfde0b78e /pkg/sentry/fs/inode_overlay.go | |
parent | e1c8eaca8f8413b17dab8f01b2e123e9d4b9ddbc (diff) |
Include original copyUp error in panic if cleanupUpper fails.
When copyUp fails, we attempt to clean up the upper filesystem by removing any
files that have already been copied-up. If the cleanup fails, we panic because
the "overlay filesystem is in an inconsistent state".
This CL adds the original copy-up error to the panic information, to hopefully
make it easier to track down how the overlay filesystem got into the
inconsistent state.
PiperOrigin-RevId: 304053370
Diffstat (limited to 'pkg/sentry/fs/inode_overlay.go')
-rw-r--r-- | pkg/sentry/fs/inode_overlay.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/fs/inode_overlay.go b/pkg/sentry/fs/inode_overlay.go index 5ada33a32..537c8d257 100644 --- a/pkg/sentry/fs/inode_overlay.go +++ b/pkg/sentry/fs/inode_overlay.go @@ -231,7 +231,8 @@ func overlayCreate(ctx context.Context, o *overlayEntry, parent *Dirent, name st upperFile.Dirent.Inode.IncRef() entry, err := newOverlayEntry(ctx, upperFile.Dirent.Inode, nil, false) if err != nil { - cleanupUpper(ctx, o.upper, name) + werr := fmt.Errorf("newOverlayEntry failed: %v", err) + cleanupUpper(ctx, o.upper, name, werr) return nil, err } |