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:
Kubernetes Prow Robot
2025-11-06 11:51:20 -08:00
committed by GitHub

View File

@@ -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)