Skip to content

Commit fd556dc

Browse files
authored
Merge pull request kubernetes#135174 from carlory/fix-135089
kubelet: fix concurrent map write error when creating a pod with empty volume
2 parents 9cd7286 + 8be985d commit fd556dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/volume/util/fsquota/quota_linux.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ func clearMountpoint(path string) {
158158
delete(mountpointMap, path)
159159
}
160160

161+
func clearSupportsQuotas(path string) {
162+
supportsQuotasLock.Lock()
163+
defer supportsQuotasLock.Unlock()
164+
delete(supportsQuotasMap, path)
165+
}
166+
161167
// getFSInfo Returns mountpoint and backing device
162168
// getFSInfo should cache the mountpoint and backing device for the
163169
// path.
@@ -430,7 +436,7 @@ func ClearQuota(m mount.Interface, path string, userNamespacesEnabled bool) erro
430436
// stale directory, so if we find a quota, just remove it.
431437
// The process of clearing the quota requires that an applier
432438
// be found, which needs to be cleaned up.
433-
defer delete(supportsQuotasMap, path)
439+
defer clearSupportsQuotas(path)
434440
defer clearApplier(path)
435441
return clearQuotaOnDir(m, path, userNamespacesEnabled)
436442
}
@@ -467,7 +473,7 @@ func ClearQuota(m mount.Interface, path string, userNamespacesEnabled bool) erro
467473
}
468474
delete(dirPodMap, path)
469475
delete(dirQuotaMap, path)
470-
delete(supportsQuotasMap, path)
476+
clearSupportsQuotas(path)
471477
clearApplier(path)
472478
if err != nil {
473479
return fmt.Errorf("unable to clear quota for %s: %v", path, err)

0 commit comments

Comments
 (0)