Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: potential deadlock #125

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 0 additions & 8 deletions cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ func (c *libcni) Setup(ctx context.Context, id string, path string, opts ...Name
if err := c.ready(); err != nil {
return nil, err
}
c.RLock()
defer c.RUnlock()
ns, err := newNamespace(id, path, opts...)
if err != nil {
return nil, err
Expand All @@ -183,8 +181,6 @@ func (c *libcni) SetupSerially(ctx context.Context, id string, path string, opts
if err := c.ready(); err != nil {
return nil, err
}
c.RLock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is totally correct (removing the lock), at least it's not clear if it is, see #126

defer c.RUnlock()
ns, err := newNamespace(id, path, opts...)
if err != nil {
return nil, err
Expand Down Expand Up @@ -248,8 +244,6 @@ func (c *libcni) Remove(ctx context.Context, id string, path string, opts ...Nam
if err := c.ready(); err != nil {
return err
}
c.RLock()
defer c.RUnlock()
ns, err := newNamespace(id, path, opts...)
if err != nil {
return err
Expand Down Expand Up @@ -278,8 +272,6 @@ func (c *libcni) Check(ctx context.Context, id string, path string, opts ...Name
if err := c.ready(); err != nil {
return err
}
c.RLock()
defer c.RUnlock()
ns, err := newNamespace(id, path, opts...)
if err != nil {
return err
Expand Down
Loading