mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
Merge pull request #135174 from carlory/fix-135089
kubelet: fix concurrent map write error when creating a pod with empty volume
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user