mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Lockdep: Print more info in the "unbalanced unlock" case.
This CL does the following: - Add the ability for nested locks to have names. - Give names to all current uses of nested locks in the codebase. - Truncate `lockdep` debug stack traces to avoid the clutter from the `lockdep` code itself - Simplify `lockdep` to not longer require `classMap`. PiperOrigin-RevId: 491486620
This commit is contained in:
committed by
gVisor bot
parent
ae731e0394
commit
445fa6f40c
@@ -1,5 +1,6 @@
|
||||
load("//tools:defs.bzl", "go_library")
|
||||
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
||||
load("//pkg/sync/locking:locking.bzl", "declare_mutex")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
@@ -42,15 +43,12 @@ go_template_instance(
|
||||
},
|
||||
)
|
||||
|
||||
go_template_instance(
|
||||
declare_mutex(
|
||||
name = "user_namespace_mutex",
|
||||
out = "user_namespace_mutex.go",
|
||||
nested_lock_names = ["ns"],
|
||||
package = "auth",
|
||||
prefix = "userNamespace",
|
||||
substrs = {
|
||||
"genericMark": "userNamespace",
|
||||
},
|
||||
template = "//pkg/sync/locking:generic_mutex",
|
||||
)
|
||||
|
||||
go_library(
|
||||
|
||||
@@ -69,8 +69,8 @@ func (ns *UserNamespace) mapID(m *idMapSet, id uint32) uint32 {
|
||||
//
|
||||
// Preconditions: end >= start.
|
||||
func (ns *UserNamespace) allIDsMapped(m *idMapSet, start, end uint32) bool {
|
||||
ns.mu.NestedLock()
|
||||
defer ns.mu.NestedUnlock()
|
||||
ns.mu.NestedLock(userNamespaceLockNs)
|
||||
defer ns.mu.NestedUnlock(userNamespaceLockNs)
|
||||
return m.SpanRange(idMapRange{start, end}) == end-start
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user