From 6bceb0030d15b70097d75f8da2d373310fe2c658 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 27 Jan 2022 22:14:49 -0700 Subject: [PATCH] LU-13335 ldiskfs: add projid to debug logs There is virtually no tracking of projid changes in osd-ldiskfs, which makes it very difficult to debug operations therein. Add some minimal debugging on the client and servers to log the projid when it is changed, along with the affected FID. Signed-off-by: Andreas Dilger Change-Id: Ibcf3f09ee243ebe052c8f9119383897072ce7057 Reviewed-on: https://review.whamcloud.com/46369 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 2 ++ lustre/osd-ldiskfs/osd_quota.c | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index cbb9f15..73c256c 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3521,6 +3521,8 @@ static int ll_set_project(struct inode *inode, __u32 xflags, __u32 projid) unsigned int inode_flags; int rc = 0; + CDEBUG(D_QUOTA, DFID" xflags=%x projid=%u\n", + PFID(ll_inode2fid(inode)), xflags, projid); rc = ll_ioctl_check_project(inode, xflags, projid); if (rc) RETURN(rc); diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 530e6fc..c69cfcd 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -541,12 +541,21 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh, { struct osd_device *dev; struct qsd_instance *qsd; + struct lu_fid fid = { 0 }; struct inode *inode = NULL; + unsigned long long ino = 0; int i, rc = 0, crd; __u8 res = qi->lqi_is_blk ? LQUOTA_RES_DT : LQUOTA_RES_MD; bool found = false; ENTRY; + if (obj) { + fid = *lu_object_fid(&obj->oo_dt.do_lu); + inode = obj->oo_inode; + ino = inode ? inode->i_ino : 0; + } + CDEBUG(D_QUOTA, "fid="DFID" ino=%llu type=%u, id=%llu\n", + PFID(&fid), ino, qi->lqi_type, qi->lqi_id.qid_uid); LASSERT(oh != NULL); LASSERTF(oh->ot_id_cnt <= OSD_MAX_UGID_CNT, "count=%d\n", @@ -572,13 +581,13 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh, if (!found) { /* we need to account for credits for this new ID */ if (i >= OSD_MAX_UGID_CNT) { - CERROR("Too many(%d) trans qids!\n", i + 1); - RETURN(-EOVERFLOW); + rc = -EOVERFLOW; + CERROR("%s: too many qids %u > %u on "DFID": rc = %d\n", + osd_name(dev), i + 1, OSD_MAX_UGID_CNT, + PFID(&fid), rc); + RETURN(rc); } - if (obj != NULL) - inode = obj->oo_inode; - if (qi->lqi_id.qid_uid == 0) { /* root ID should be always present in the quota file */ crd = 1; -- 1.8.3.1