From 5e6a30cc2f344e38dd11ef3db1eb23c1705d8f32 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 12 Jul 2019 15:24:30 -0400 Subject: [PATCH 1/1] LU-12538 lod: Add missed qos_rr_init The new lmv space hash code uses the lu_qos_rr struct, but forgot to init it fully. Specifically, the spin lock isn't inited, causing failures. Signed-off-by: Patrick Farrell Change-Id: Id410a8dc61980b880eab7e151b85c417a8439fd5 Reviewed-on: https://review.whamcloud.com/35490 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Lai Siyao Tested-by: Maloo --- lustre/include/lu_object.h | 1 + lustre/lmv/lmv_obd.c | 3 ++- lustre/lod/lod_internal.h | 1 - lustre/lod/lod_lov.c | 4 ++-- lustre/lod/lod_pool.c | 3 ++- lustre/lod/lod_qos.c | 6 ------ lustre/obdclass/lu_qos.c | 7 +++++++ 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 13720c1..4a7df97 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1468,6 +1468,7 @@ struct lu_qos { lq_reset:1; /* zero current penalties */ }; +void lu_qos_rr_init(struct lu_qos_rr *lqr); int lqos_add_tgt(struct lu_qos *qos, struct lu_tgt_desc *ltd); int lqos_del_tgt(struct lu_qos *qos, struct lu_tgt_desc *ltd); u64 lu_prandom_u64_max(u64 ep_ro); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 83e82ca..4cd844f 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1311,13 +1311,14 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) INIT_LIST_HEAD(&lmv->lmv_qos.lq_svr_list); init_rwsem(&lmv->lmv_qos.lq_rw_sem); lmv->lmv_qos.lq_dirty = 1; - lmv->lmv_qos.lq_rr.lqr_dirty = 1; lmv->lmv_qos.lq_reset = 1; /* Default priority is toward free space balance */ lmv->lmv_qos.lq_prio_free = 232; /* Default threshold for rr (roughly 17%) */ lmv->lmv_qos.lq_threshold_rr = 43; + lu_qos_rr_init(&lmv->lmv_qos.lq_rr); + /* * initialize rr_index to lower 32bit of netid, so that client * can distribute subdirs evenly from the beginning. diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h index e30be97..fcd9bfc 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h @@ -692,7 +692,6 @@ struct lod_obj_stripe_cb_data { int lod_prepare_create(const struct lu_env *env, struct lod_object *lo, struct lu_attr *attr, const struct lu_buf *buf, struct thandle *th); -void lod_qos_rr_init(struct lu_qos_rr *lqr); int lod_use_defined_striping(const struct lu_env *, struct lod_object *, const struct lu_buf *); int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo, diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index b37bdcf..bb8e3cf 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -2199,13 +2199,14 @@ int lod_pools_init(struct lod_device *lod, struct lustre_cfg *lcfg) INIT_LIST_HEAD(&lod->lod_qos.lq_svr_list); init_rwsem(&lod->lod_qos.lq_rw_sem); lod->lod_qos.lq_dirty = 1; - lod->lod_qos.lq_rr.lqr_dirty = 1; lod->lod_qos.lq_reset = 1; /* Default priority is toward free space balance */ lod->lod_qos.lq_prio_free = 232; /* Default threshold for rr (roughly 17%) */ lod->lod_qos.lq_threshold_rr = 43; + lu_qos_rr_init(&lod->lod_qos.lq_rr); + /* Set up OST pool environment */ lod->lod_pools_hash_body = cfs_hash_create("POOLS", HASH_POOLS_CUR_BITS, HASH_POOLS_MAX_BITS, @@ -2222,7 +2223,6 @@ int lod_pools_init(struct lod_device *lod, struct lustre_cfg *lcfg) rc = lod_ost_pool_init(&lod->lod_pool_info, 0); if (rc) GOTO(out_hash, rc); - lod_qos_rr_init(&lod->lod_qos.lq_rr); rc = lod_ost_pool_init(&lod->lod_qos.lq_rr.lqr_pool, 0); if (rc) GOTO(out_pool_info, rc); diff --git a/lustre/lod/lod_pool.c b/lustre/lod/lod_pool.c index 032d094..c1426f3 100644 --- a/lustre/lod/lod_pool.c +++ b/lustre/lod/lod_pool.c @@ -661,7 +661,8 @@ int lod_pool_new(struct obd_device *obd, char *poolname) if (rc) GOTO(out_err, rc); - lod_qos_rr_init(&new_pool->pool_rr); + lu_qos_rr_init(&new_pool->pool_rr); + rc = lod_ost_pool_init(&new_pool->pool_rr.lqr_pool, 0); if (rc) GOTO(out_free_pool_obds, rc); diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 5015310..7d738f3 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -435,12 +435,6 @@ static int lod_qos_used(struct lod_device *lod, struct ost_pool *osts, RETURN(0); } -void lod_qos_rr_init(struct lu_qos_rr *lqr) -{ - spin_lock_init(&lqr->lqr_alloc); - lqr->lqr_dirty = 1; -} - #define LOV_QOS_EMPTY ((__u32)-1) /** diff --git a/lustre/obdclass/lu_qos.c b/lustre/obdclass/lu_qos.c index ade9c1f..f84954c 100644 --- a/lustre/obdclass/lu_qos.c +++ b/lustre/obdclass/lu_qos.c @@ -44,6 +44,13 @@ #include #include +void lu_qos_rr_init(struct lu_qos_rr *lqr) +{ + spin_lock_init(&lqr->lqr_alloc); + lqr->lqr_dirty = 1; +} +EXPORT_SYMBOL(lu_qos_rr_init); + /** * Add a new target to Quality of Service (QoS) target table. * -- 1.8.3.1