From: Alex Zhuravlev Date: Mon, 23 Dec 2024 05:35:09 +0000 (+0300) Subject: LU-7021 osd: fix credits optimization X-Git-Tag: 2.16.54~14 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2e525833a6df942ab55757edfa84bbcfd093a9e3;p=fs%2Flustre-release.git LU-7021 osd: fix credits optimization 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 Change-Id: If859e64033487574ebb670e80f11c968f1595d00 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57570 Reviewed-by: Mikhail Pershin Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 80b07eb..5447990 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -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