From 6cdb08a0c598b20a4b0ce27f7fe4763b0ada3118 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. HPE-bug-id: LUS-2106 Signed-off-by: Alexander Boyko Signed-off-by: Alexey Lyashkov Change-Id: Id9f0ea2fa006bee601d05e14b2e515fcf8248249 Reviewed-on: https://review.whamcloud.com/41497 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- 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 809afe1..5e55af8 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1548,6 +1548,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 */ }; #ifdef HAVE_SERVER_SUPPORT diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index f6571f3..4a46796 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -210,11 +210,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)) @@ -224,10 +228,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