func ClearQuota(m mount.Interface, path string) error {
	klog.V(3).Infof("ClearQuota %s", path)
	if !enabledQuotasForMonitoring() {
		return fmt.Errorf("ClearQuota called, but quotas disabled")
	}
	quotaLock.Lock()
	defer quotaLock.Unlock()
	poduid, ok := dirPodMap[path]
	if !ok {
		// Nothing in the map either means that there was no
		// quota to begin with or that we're clearing a
		// 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 clearApplier(path)
		return clearQuotaOnDir(m, path)
	}
	_, ok = podQuotaMap[poduid]
	if !ok {
		return fmt.Errorf("ClearQuota: No quota available for %s", path)
	}
	projid, err := getQuotaOnDir(m, path)
	if err != nil {
		// Log-and-continue instead of returning an error for now
		// due to unspecified backwards compatibility concerns (a subject to revise)
		klog.V(3).Infof("Attempt to check quota ID %v on dir %s failed: %v", dirQuotaMap[path], path, err)
	}
	if projid != dirQuotaMap[path] {
		return fmt.Errorf("Expected quota ID %v on dir %s does not match actual %v", dirQuotaMap[path], path, projid)
	}
	count, ok := podDirCountMap[poduid]
	if count <= 1 || !ok {
		err = clearQuotaOnDir(m, path)
		// This error should be noted; we still need to clean up
		// and otherwise handle in the same way.
		if err != nil {
			klog.V(3).Infof("Unable to clear quota %v %s: %v", dirQuotaMap[path], path, err)
		}
		delete(quotaSizeMap, podQuotaMap[poduid])
		delete(quotaPodMap, podQuotaMap[poduid])
		delete(podDirCountMap, poduid)
		delete(podQuotaMap, poduid)
	} else {
		err = removeProjectID(path, projid)
		podDirCountMap[poduid]--
		klog.V(4).Infof("Not clearing quota for pod %s; still %v dirs outstanding", poduid, podDirCountMap[poduid])
	}
	delete(dirPodMap, path)
	delete(dirQuotaMap, path)
	delete(supportsQuotasMap, path)
	clearApplier(path)
	if err != nil {
		return fmt.Errorf("Unable to clear quota for %s: %v", path, err)
	}
	return nil
}
// ClearQuota -- remove the quota assigned to a directory
- remove the quota assigned to a directory
// ClearQuota -- remove the quota assigned to a directory
func ClearQuota(m mount.Interface, path string) error {
	klog.V(3).Infof("ClearQuota %s", path)
	if !enabledQuotasForMonitoring() {
		return fmt.Errorf("ClearQuota called, but quotas disabled")
	}
	quotaLock.Lock()
	defer quotaLock.Unlock()
	poduid, ok := dirPodMap[path]
	if !ok {
		defer delete(supportsQuotasMap, path)
		defer clearApplier(path)
		return clearQuotaOnDir(m, path)
	}
	_, ok = podQuotaMap[poduid]
	if !ok {
		return fmt.Errorf("ClearQuota: No quota available for %s", path)
	}
	projid, err := getQuotaOnDir(m, path)
	if err != nil {
		klog.V(3).Infof("Attempt to check quota ID %v on dir %s failed: %v", dirQuotaMap[path], path, err)
	}
	if projid != dirQuotaMap[path] {
		return fmt.Errorf("Expected quota ID %v on dir %s does not match actual %v", dirQuotaMap[path], path, projid)
	}
	count, ok := podDirCountMap[poduid]
	if count <= 1 || !ok {
		err = clearQuotaOnDir(m, path)
		if err != nil {
			klog.V(3).Infof("Unable to clear quota %v %s: %v", dirQuotaMap[path], path, err)
		}
		delete(quotaSizeMap, podQuotaMap[poduid])
		delete(quotaPodMap, podQuotaMap[poduid])
		delete(podDirCountMap, poduid)
		delete(podQuotaMap, poduid)
	} else {
		err = removeProjectID(path, projid)
		podDirCountMap[poduid]--
		klog.V(4).Infof("Not clearing quota for pod %s; still %v dirs outstanding", poduid, podDirCountMap[poduid])
	}
	delete(dirPodMap, path)
	delete(dirQuotaMap, path)
	delete(supportsQuotasMap, path)
	clearApplier(path)
	if err != nil {
		return fmt.Errorf("Unable to clear quota for %s: %v", path, err)
	}
	return nil
}
func ClearQuota ( m mount . Interface , path string ) error { klog . V ( 3 ) . Infof ( " " , path ) if ! enabledQuotasForMonitoring ( ) { return fmt . Errorf ( " " ) } quotaLock . Lock ( ) defer quotaLock . Unlock ( ) poduid , ok := dirPodMap [ path ] if ! ok { defer delete ( supportsQuotasMap , path ) defer clearApplier ( path ) return clearQuotaOnDir ( m , path ) } _ , ok = podQuotaMap [ poduid ] if ! ok { return fmt . Errorf ( " " , path ) } projid , err := getQuotaOnDir ( m , path ) if err != nil { klog . V ( 3 ) . Infof ( " " , dirQuotaMap [ path ] , path , err ) } if projid != dirQuotaMap [ path ] { return fmt . Errorf ( " " , dirQuotaMap [ path ] , path , projid ) } count , ok := podDirCountMap [ poduid ] if count <= 1 || ! ok { err = clearQuotaOnDir ( m , path ) if err != nil { klog . V ( 3 ) . Infof ( " " , dirQuotaMap [ path ] , path , err ) } delete ( quotaSizeMap , podQuotaMap [ poduid ] ) delete ( quotaPodMap , podQuotaMap [ poduid ] ) delete ( podDirCountMap , poduid ) delete ( podQuotaMap , poduid ) } else { err = removeProjectID ( path , projid ) podDirCountMap [ poduid ] -- klog . V ( 4 ) . Infof ( " " , poduid , podDirCountMap [ poduid ] ) } delete ( dirPodMap , path ) delete ( dirQuotaMap , path ) delete ( supportsQuotasMap , path ) clearApplier ( path ) if err != nil { return fmt . Errorf ( " " , path , err ) } return nil }
remove the quota assigned to a directory
remove the quota assigned to a directory
// Nothing in the map either means that there was no // quota to begin with or that we're clearing a // 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. // Log-and-continue instead of returning an error for now // due to unspecified backwards compatibility concerns (a subject to revise) // This error should be noted; we still need to clean up // and otherwise handle in the same way.