From 79b3126f00afd5c3ca6c2956bd0181ca4dacd6f4 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 4 Apr 2023 11:25:45 +0800 Subject: [PATCH] skip clear quota if FSQuotaMonitoring is disabled --- pkg/volume/emptydir/empty_dir.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/volume/emptydir/empty_dir.go b/pkg/volume/emptydir/empty_dir.go index 9ad981c54bd..e9c0a14bbbf 100644 --- a/pkg/volume/emptydir/empty_dir.go +++ b/pkg/volume/emptydir/empty_dir.go @@ -519,10 +519,12 @@ func (ed *emptyDir) TearDownAt(dir string) error { } func (ed *emptyDir) teardownDefault(dir string) error { - // Remove any quota - err := fsquota.ClearQuota(ed.mounter, dir) - if err != nil { - klog.Warningf("Warning: Failed to clear quota on %s: %v", dir, err) + if utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolationFSQuotaMonitoring) { + // Remove any quota + err := fsquota.ClearQuota(ed.mounter, dir) + if err != nil { + klog.Warningf("Warning: Failed to clear quota on %s: %v", dir, err) + } } // Renaming the directory is not required anymore because the operation executor // now handles duplicate operations on the same volume