Merge pull request #36901 from leitzler/issue_36858_SA2003

Automatic merge from submit-queue

Fix SA2003, deferred Lock right after locking

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**:
Fixes a re-locking right after a lock. This is a part if issue #36858.

**Special notes for your reviewer**:
N/A

**Release note**:
NONE
This commit is contained in:
Kubernetes Submit Queue 2016-11-16 13:04:09 -08:00 committed by GitHub
commit f918dd64c4

View File

@ -121,7 +121,7 @@ func (r *ServiceRegistry) WatchServices(ctx api.Context, options *api.ListOption
func (r *ServiceRegistry) ExportService(ctx api.Context, name string, options unversioned.ExportOptions) (*api.Service, error) {
r.mu.Lock()
defer r.mu.Lock()
defer r.mu.Unlock()
return r.Service, r.Err
}