Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/tcpip/transport/tcp/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func (e *Endpoint) LockUser() {
// Finally just give up and wait for the Lock.
e.mu.Lock()
e.ownedByUser.Store(1)
return // +checklocksforce: this locks e.snd.ep.mu
}

// UnlockUser will check if there are any segments already queued for processing
Expand Down Expand Up @@ -753,6 +754,7 @@ func (e *Endpoint) AssertLockHeld(locked *Endpoint) {
if e != locked {
panic("AssertLockHeld failed: locked endpoint != asserting endpoint")
}
return // +checklocksforce
}

// TryLock is a helper that calls TryLock on the endpoint's mutex and
Expand Down
2 changes: 2 additions & 0 deletions tools/checklocks/test/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func testInconsistentReturn(tc *oneGuardStruct) { // +checklocksfail
if x := rand.Intn(10); x%2 == 1 {
tc.mu.Lock()
}
return
}

func testConsistentBranching(tc *oneGuardStruct) {
Expand Down Expand Up @@ -53,6 +54,7 @@ func testInconsistentBranching(tc *oneGuardStruct) { // +checklocksfail:2
if x%2 == 1 {
tc.mu.Unlock() // +checklocksforce
}
return
}

func testUnboundedLocks(tc []*oneGuardStruct) {
Expand Down
1 change: 1 addition & 0 deletions tools/checklocks/test/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func standaloneFunctionWithGuard(a *testMethodsWithParameters) {
a.guardedField = 1
a.mu.Unlock()
a.guardedField = 1 // +checklocksfail
return // +checklocksfail
}

type testMethodsWithEmbedded struct {
Expand Down