sentry: do not release gofer inode file state loading lock upon error.

When an inode file state failed to load asynchronuously, we want to report
the error instead of potentially panicing in another async loading goroutine
incorrectly unblocked.

PiperOrigin-RevId: 209683977
Change-Id: I591cde97710bbe3cdc53717ee58f1d28bbda9261
This commit is contained in:
Zhaozhong Ni
2018-08-21 16:52:27 -07:00
committed by Shentubot
parent e29a02239e
commit 8bb50dab79
+6 -3
View File
@@ -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 {