From b31a51db8418561d01d64ea43c9987c44e2959df Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Mon, 4 Sep 2023 08:45:34 -0400 Subject: [PATCH] LU-17087 lmv: update stale tgt statfs every 1 hour Some tgt statfs may not be initialized upon mount due to network issues, if the filesystem is imbalanced, these tgts won't be chosen to create directory because their bavail and ffree are 0. If MDT is chosen by QoS, update tgt statfs that is one hour overdue, otherwise check update the statfs of the tgt that is chosen. Lustre-commit: e262e0ffbe792ae2f8b47ccdafac38a36151a300 Lustre-change: https://review.whamcloud.com/52270 Signed-off-by: Lai Siyao Change-Id: I06af8b8bd342f66cb794471df3ee0f3b127ffe05 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52560 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/lmv/lmv_obd.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 0f41099..ab36f63 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1542,7 +1542,10 @@ static struct lu_tgt_desc *lmv_locate_tgt_qos(struct lmv_obd *lmv, tgt->ltd_qos.ltq_usable = 0; continue; } - + /* update one hour overdue statfs */ + if (ktime_get_seconds() - tgt->ltd_statfs_age > + 60 * lmv->lmv_mdt_descs.ltd_lmv_desc.ld_qos_maxage) + lmv_statfs_check_update(lmv2obd_dev(lmv), tgt); tgt->ltd_qos.ltq_usable = 1; lu_tgt_qos_weight_calc(tgt, true); if (tgt->ltd_index == op_data->op_mds) @@ -1952,18 +1955,12 @@ static struct lu_tgt_desc *lmv_locate_tgt_by_space(struct lmv_obd *lmv, tgt = tmp; else tgt = lmv_locate_tgt_rr(lmv); + if (!IS_ERR(tgt)) + lmv_statfs_check_update(lmv2obd_dev(lmv), tgt); } - /* - * only update statfs after QoS mkdir, this means the cached statfs may - * be stale, and current mkdir may not follow QoS accurately, but it's - * not serious, and avoids periodic statfs when client doesn't mkdir by - * QoS. - */ - if (!IS_ERR(tgt)) { + if (!IS_ERR(tgt)) op_data->op_mds = tgt->ltd_index; - lmv_statfs_check_update(lmv2obd_dev(lmv), tgt); - } return tgt; } -- 1.8.3.1