From 4e122214f7d61e64d35bf8510ce53ae3234188aa Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Thu, 3 Nov 2022 13:01:39 -0400 Subject: [PATCH] core: fix start up policy loading race condition on perf standbys (#17801) * core: fix start up policy loading race condition on perf standbys * Use correct bool for perf standby * changelog --- changelog/17801.txt | 4 ++++ vault/policy_store.go | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 changelog/17801.txt diff --git a/changelog/17801.txt b/changelog/17801.txt new file mode 100644 index 000000000..8d3764ad4 --- /dev/null +++ b/changelog/17801.txt @@ -0,0 +1,4 @@ +```release-note:bug +core: fix a start up race condition where performance standbys could go into a +mount loop if default policies are not yet synced from the active node. +``` diff --git a/vault/policy_store.go b/vault/policy_store.go index db92ebab5..bdbfb6776 100644 --- a/vault/policy_store.go +++ b/vault/policy_store.go @@ -264,6 +264,11 @@ func (c *Core) setupPolicyStore(ctx context.Context) error { return nil } + if c.perfStandby { + // Policies will sync from the active + return nil + } + // Ensure that the default policy exists, and if not, create it if err := c.policyStore.loadACLPolicy(ctx, defaultPolicyName, defaultPolicy); err != nil { return err