Change:
I have kubernetes 1.24.7. I tried to use on formated volume. It works until first reboot. After reboot, I get messages: I expect that project quota can be assigned even after reboot. Use xfs for /var/lib/containerd with discard,quota,prjquota No response <details</details<detailsbaremetal </details<details</details<details</details<detailsrke2 </details<details</details
/sig node Can this be reproduced? Can this pod be recreated correctly if you force delete the pod?
/triage accepted
It can be reproduced. Pod is created if I remove . I can test force delete.
/assign we are looking into gate to understand if we need to keep it or deprecate it.
If I force delete pod, it does not start again:
/assign Let me check on the latest code with the fix

Discussion:
if err != nil { klog.V(3).Infof("Unable to check for quota support on %s: %s", dir, err.Error()) } else if hasQuotas { <del> _, err := fsquota.GetQuotaOnDir(ed.mounter, dir) if err != nil { klog.V(4).Infof("Attempt to check quota on dir %s failed: %v", dir, err) // this is not a fatal error so return nil return nil } </del> klog.V(4).Infof("emptydir trying to assign quota %v on %s", mounterSize, dir) if err := fsquota.AssignQuota(ed.mounter, dir, ed.pod.UID, mounterSize); err != nil { klog.V(3).Infof("Set quota on %s failed %s", dir, err.Error())

idMap := make(map[common.QuotaID]bool) for _, project := range list.projects { if project.data == path { <del> if id != project.id { </del> <ins> if id != common.BadQuotaID && id != project.id { </ins> return common.BadQuotaID, false, fmt.Errorf("attempt to reassign project ID for %s", path) } // Trying to reassign a directory to the project it's // already in.  Maybe this should be an error, but for // now treat it as an idempotent operation <del> return id, false, nil </del> <ins> return project.id, false, nil </ins> } idMap[project.id] = true }

"k8s.io/kubernetes/pkg/volume/util/fsquota/common" ) <ins> // Pod -> External Pod UID var podUidMap = make(map[types.UID]types.UID) </ins> // Pod -> ID var podQuotaMap = make(map[types.UID]common.QuotaID)

} quotaLock.Lock() defer quotaLock.Unlock() <del> // Current policy is to set individual quotas on each volumes. </del> <ins> // Current policy is to set individual quotas on each volume, // for each new volume we generate a random UUID and we use that as // the internal pod uid. // From fsquota point of view each volume is attached to a // single unique pod. </ins> // If we decide later that we want to assign one quota for all <del> // volumes in a pod, we can simply remove this line of code. </del> <ins> // volumes in a pod, we can simply use poduid parameter directly </ins> // If and when we decide permanently that we're going to adopt // one quota per volume, we can rip all of the pod code out. <del> volumeuid := types.UID(uuid.NewUUID()) if pod, ok := dirPodMap[path]; ok && pod != volumeuid { return fmt.Errorf("requesting quota on existing directory %s but different pod %s %s", path, pod, volumeuid) </del> <ins> externalPodUid := poduid internalPodUid, ok := dirPodMap[path] if ok { if podUidMap[internalPodUid] != externalPodUid { return fmt.Errorf("requesting quota on existing directory %s but different pod %s %s", path, podUidMap[internalPodUid], externalPodUid) } } else { internalPodUid = types.UID(uuid.NewUUID()) </ins> } <del> oid, ok := podQuotaMap[volumeuid] </del> <ins> oid, ok := podQuotaMap[internalPodUid] </ins> if ok { if quotaSizeMap[oid] != ibytes { return fmt.Errorf("requesting quota of different size: old %v new %v", quotaSizeMap[oid], bytes) } <ins> if _, ok := dirPodMap[path]; ok { return nil } </ins> } else { oid = common.BadQuotaID }

ibytes = -1 } if err = setQuotaOnDir(path, id, ibytes); err == nil { <del> quotaPodMap[id] = volumeuid </del> <ins> quotaPodMap[id] = internalPodUid </ins> quotaSizeMap[id] = ibytes <del> podQuotaMap[volumeuid] = id </del> <ins> podQuotaMap[internalPodUid] = id </ins> dirQuotaMap[path] = id <del> dirPodMap[path] = volumeuid podDirCountMap[volumeuid]++ </del> <ins> dirPodMap[path] = internalPodUid podUidMap[internalPodUid] = externalPodUid podDirCountMap[internalPodUid]++ </ins> klog.V(4).Infof("Assigning quota ID %d (%d) to %s", id, ibytes, path) return nil }

delete(quotaPodMap, podQuotaMap[poduid]) delete(podDirCountMap, poduid) delete(podQuotaMap, poduid) <ins> delete(podUidMap, poduid) </ins> } else { err = removeProjectID(path, projid) podDirCountMap[poduid]--