diff --git a/pkg/volume/util/fsquota/quota_linux.go b/pkg/volume/util/fsquota/quota_linux.go index ef24cedb249..6ddf4d4d50f 100644 --- a/pkg/volume/util/fsquota/quota_linux.go +++ b/pkg/volume/util/fsquota/quota_linux.go @@ -158,6 +158,12 @@ func clearMountpoint(path string) { delete(mountpointMap, path) } +func clearSupportsQuotas(path string) { + supportsQuotasLock.Lock() + defer supportsQuotasLock.Unlock() + delete(supportsQuotasMap, path) +} + // getFSInfo Returns mountpoint and backing device // getFSInfo should cache the mountpoint and backing device for the // path. @@ -430,7 +436,7 @@ func ClearQuota(m mount.Interface, path string, userNamespacesEnabled bool) erro // stale directory, so if we find a quota, just remove it. // The process of clearing the quota requires that an applier // be found, which needs to be cleaned up. - defer delete(supportsQuotasMap, path) + defer clearSupportsQuotas(path) defer clearApplier(path) return clearQuotaOnDir(m, path, userNamespacesEnabled) } @@ -467,7 +473,7 @@ func ClearQuota(m mount.Interface, path string, userNamespacesEnabled bool) erro } delete(dirPodMap, path) delete(dirQuotaMap, path) - delete(supportsQuotasMap, path) + clearSupportsQuotas(path) clearApplier(path) if err != nil { return fmt.Errorf("unable to clear quota for %s: %v", path, err)