From 5016a9bfbd05843fb5cd29d1bf6813f8923d2c90 Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Fri, 29 Jan 2021 12:29:27 +0300 Subject: [PATCH] LU-14277 lod: statfs should not block a create lod_qos_statfs_update() need a guarantee that targets isn't changed, so it doesn't need to take a QoS mutex. Lustre-change: https://review.whamcloud.com/41497 Lustre-commit: 6cdb08a0c598b20a4b0ce27f7fe4763b0ada3118 HPE-bug-id: LUS-2106 Signed-off-by: Alexander Boyko Signed-off-by: Alexey Lyashkov Change-Id: Id9f0ea2fa006bee601d05e14b2e515fcf8248249 Reviewed-by: Andrew Perepechko Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51246 Tested-by: jenkins Tested-by: Andreas Dilger Reviewed-by: Andreas Dilger --- lustre/include/lu_object.h | 1 + lustre/lod/lod_qos.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index c9cd0c7..129a157 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1530,6 +1530,7 @@ enum lq_flag { LQ_SAME_SPACE, /* the OSTs all have approx. * the same space avail */ LQ_RESET, /* zero current penalties */ + LQ_SF_PROGRESS, /* statfs op in progress */ }; /* round-robin QoS data for LOD/LMV */ diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 4bcbe56..4995a36 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -209,11 +209,15 @@ void lod_qos_statfs_update(const struct lu_env *env, struct lod_device *lod, /* statfs data are quite recent, don't need to refresh it */ RETURN_EXIT; - down_write(<d->ltd_qos.lq_rw_sem); - - if (obd->obd_osfs_age > max_age) - goto out; + if (test_and_set_bit(LQ_SF_PROGRESS, <d->ltd_qos.lq_flags)) + RETURN_EXIT; + if (obd->obd_osfs_age > max_age) { + /* statfs data are quite recent, don't need to refresh it */ + clear_bit(LQ_SF_PROGRESS, <d->ltd_qos.lq_flags); + RETURN_EXIT; + } + lod_getref(ltd); ltd_foreach_tgt(ltd, tgt) { avail = tgt->ltd_statfs.os_bavail; if (lod_statfs_and_check(env, lod, ltd, tgt, 0)) @@ -223,10 +227,10 @@ void lod_qos_statfs_update(const struct lu_env *env, struct lod_device *lod, /* recalculate weigths */ set_bit(LQ_DIRTY, <d->ltd_qos.lq_flags); } + lod_putref(lod, ltd); obd->obd_osfs_age = ktime_get_seconds(); -out: - up_write(<d->ltd_qos.lq_rw_sem); + clear_bit(LQ_SF_PROGRESS, <d->ltd_qos.lq_flags); EXIT; } -- 1.8.3.1