Skip to content

fix(locks): Adding read locks and mutex locks for state#94

Open
NucleoFusion wants to merge 1 commit intocheckpoint-restore:mainfrom
NucleoFusion:main
Open

fix(locks): Adding read locks and mutex locks for state#94
NucleoFusion wants to merge 1 commit intocheckpoint-restore:mainfrom
NucleoFusion:main

Conversation

@NucleoFusion
Copy link
Copy Markdown

This PR adds proper synchronization around global policy variables to prevent potential data races between:

Changes

  • Added policyMutex.Lock() to resetAllPoliciesToDefault
  • Added policyMutex.RLock() in findContainerPolicy, findPodPolicy, and findNamespacePolicy
  • Added short-lived RLock when reading checkpointDirectory
  • Snapshot global policy values in applyPolicies before performing filesystem operations

Locks are scoped narrowly and are not held across filesystem or Kubernetes API calls.

No functional behavior changes.

Signed-off-by: NucleoFusion <lakshit.singh.mail@gmail.com>
@NucleoFusion
Copy link
Copy Markdown
Author

Hi @adrianreber
ptal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant