From 487cb7382571e090739455167ce0d7ff6d17c57f Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 17 Jan 2018 15:46:23 +0800 Subject: [PATCH] LU-10429 lod: LBUG lod_comp_ost_in_use() * print more debug info in lod_comp_ost_in_use(). * lod_alloc_qos() could possibly rollback too much items in the inuse array, leads to negative inuse array count number. Signed-off-by: Bobi Jam Change-Id: Ie3787f193468c6b783776e7df2ed4a6d54d8a12b Reviewed-on: https://review.whamcloud.com/30889 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- lustre/lod/lod_lov.c | 12 +++++++----- lustre/lod/lod_qos.c | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index e099a6c..18eba3e 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -1305,23 +1305,25 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, * then user has specified ost list for this component. */ if (!lod_comp_inited(lod_comp)) { + __u16 stripe_count; + if (objs[0].l_ost_idx != (__u32)-1UL) { + stripe_count = lod_comp_entry_stripe_count( + lo, lod_comp, false); /** * load the user specified ost list, when this * component is instantiated later, it will be * used in lod_alloc_ost_list(). */ - lod_comp->llc_ostlist.op_count = - lod_comp->llc_stripe_count; + lod_comp->llc_ostlist.op_count = stripe_count; lod_comp->llc_ostlist.op_size = - lod_comp->llc_stripe_count * - sizeof(__u32); + stripe_count * sizeof(__u32); OBD_ALLOC(lod_comp->llc_ostlist.op_array, lod_comp->llc_ostlist.op_size); if (!lod_comp->llc_ostlist.op_array) GOTO(out, rc = -ENOMEM); - for (j = 0; j < lod_comp->llc_stripe_count; j++) + for (j = 0; j < stripe_count; j++) lod_comp->llc_ostlist.op_array[j] = le32_to_cpu(objs[j].l_ost_idx); diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 91420d5..f554cf9 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -854,8 +854,9 @@ static inline void lod_comp_ost_in_use(struct ost_pool *inuse, int ost) { LASSERT(inuse != NULL); if (inuse->op_size && !lod_comp_is_ost_used(inuse, ost)) { - LASSERT(inuse->op_count * sizeof(inuse->op_array[0]) < - inuse->op_size); + LASSERTF(inuse->op_count * sizeof(inuse->op_array[0]) < + inuse->op_size, + "count %d size %u", inuse->op_count, inuse->op_size); inuse->op_array[inuse->op_count] = ost; inuse->op_count++; } @@ -1438,7 +1439,8 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, struct pool_desc *pool = NULL; struct ost_pool *osts; unsigned int i; - __u32 nfound, good_osts, stripe_count, stripe_count_min; + __u32 nfound, good_osts, stripe_count, stripe_count_min; + __u32 inuse_old_count = inuse->op_count; int rc = 0; ENTRY; @@ -1622,7 +1624,7 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, } LASSERTF(nfound <= inuse->op_count, "nfound:%d, op_count:%u\n", nfound, inuse->op_count); - inuse->op_count -= nfound; + inuse->op_count = inuse_old_count; /* makes sense to rebalance next time */ lod->lod_qos.lq_dirty = 1; -- 1.8.3.1