summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/device/device.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/device/device.go')
-rw-r--r--pkg/sentry/device/device.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/sentry/device/device.go b/pkg/sentry/device/device.go
index 69e71e322..6ca9dc79f 100644
--- a/pkg/sentry/device/device.go
+++ b/pkg/sentry/device/device.go
@@ -188,6 +188,9 @@ type MultiDevice struct {
// String stringifies MultiDevice.
func (m *MultiDevice) String() string {
+ m.mu.Lock()
+ defer m.mu.Unlock()
+
buf := bytes.NewBuffer(nil)
buf.WriteString("cache{")
for k, v := range m.cache {
@@ -253,7 +256,7 @@ func (m *MultiDevice) Load(key MultiDeviceKey, value uint64) bool {
}
if k, exists := m.rcache[value]; exists && k != key {
// Should never happen.
- panic("MultiDevice's caches are inconsistent")
+ panic(fmt.Sprintf("MultiDevice's caches are inconsistent, current: %+v, previous: %+v", key, k))
}
// Cache value at key.