Whamcloud - gitweb
LU-7021 osd: fix credits optimization 70/57570/5
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 23 Dec 2024 05:35:09 +0000 (08:35 +0300)
committerOleg Drokin <green@whamcloud.com>
Thu, 10 Apr 2025 06:54:06 +0000 (06:54 +0000)
as object's uid/gid can change after declaration in a concurrent
thread, we can't really trust them to optimaze credits calculation.
so only target uid/gid (what we declare to change to) can be used
for optimization.

Fixes: 9f79d4488  ("LU-10048 ofd: take local locks within transaction")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: If859e64033487574ebb670e80f11c968f1595d00
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57570
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre/osd-ldiskfs/osd_quota.c

index 80b07eb..5447990 100644 (file)
@@ -580,8 +580,11 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
                        RETURN(rc);
                }
 
-               if (qi->lqi_id.qid_uid == 0) {
-                       /* root ID should be always present in the quota file */
+               if (qi->lqi_id.qid_uid == 0 && qi->lqi_space > 0) {
+                       /* root ID should be always present in the quota file,
+                        * also only "target" uid (where we add space) is
+                        * guaranteed, the source one can change after the
+                        * declaration */
                        crd = 1;
                } else {
                        /* can't rely on the current state as it can change