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

Tackle #4929 a different way #4932

Merged
merged 3 commits into from
Jul 24, 2018
Merged

Conversation

jefferai
Copy link
Member

This turns c.sealed into an atomic, which allows us to call sealInternal
without a lock. By doing so we can better control lock grabbing when a
condition causing the standby loop to get out of active happens. This
encapsulates that logic into two distinct pieces (although they could
be combined into one), and makes lock guarding more understandable.

This turns c.sealed into an atomic, which allows us to call sealInternal
without a lock. By doing so we can better control lock grabbing when a
condition causing the standby loop to get out of active happens. This
encapsulates that logic into two distinct pieces (although they could
be combined into one), and makes lock guarding more understandable.
@jefferai jefferai added this to the 0.10.4 milestone Jul 16, 2018
@@ -686,9 +673,6 @@ func (c *Core) SecretProgress() (int, string) {
func (c *Core) ResetUnsealProcess() {
c.stateLock.Lock()
defer c.stateLock.Unlock()
if !c.sealed {
Copy link
Member Author

Choose a reason for hiding this comment

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

Note -- I came across this while looking for c.sealed, but I think it's an error anyways. I can't see a reason why we shouldn't reset this when asked, regardless of seal state.


case <-stopCh:
runSealing()
releaseHALock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Might as well return here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point, will fix.

@briankassouf briankassouf merged commit 8d2d9fd into master Jul 24, 2018
@briankassouf briankassouf deleted the step-down-locking-atomic-sealed branch July 24, 2018 20:57
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.

2 participants