diff options
-rw-r--r-- | pkg/sentry/fs/gofer/inode_state.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/sentry/fs/gofer/inode_state.go b/pkg/sentry/fs/gofer/inode_state.go index 33ec33364..4f2b01c72 100644 --- a/pkg/sentry/fs/gofer/inode_state.go +++ b/pkg/sentry/fs/gofer/inode_state.go @@ -108,9 +108,13 @@ func (i *inodeFileState) loadLoading(_ struct{}) { // afterLoad is invoked by stateify. func (i *inodeFileState) afterLoad() { - load := func() error { + load := func() (err error) { // See comment on i.loading(). - defer i.loading.Unlock() + defer func() { + if err == nil { + i.loading.Unlock() + } + }() // Manually restore the p9.File. name, ok := i.s.inodeMappings[i.sattr.InodeID] @@ -121,7 +125,6 @@ func (i *inodeFileState) afterLoad() { } // TODO: Context is not plumbed to save/restore. ctx := &dummyClockContext{context.Background()} - var err error _, i.file, err = i.s.attach.walk(ctx, splitAbsolutePath(name)) if err != nil { |