Whamcloud - gitweb
LU-10429 lod: LBUG lod_comp_ost_in_use() 89/30889/2
authorBobi Jam <bobijam.xu@intel.com>
Wed, 17 Jan 2018 07:46:23 +0000 (15:46 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 25 Jan 2018 04:46:23 +0000 (04:46 +0000)
* 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 <bobijam.xu@intel.com>
Change-Id: Ie3787f193468c6b783776e7df2ed4a6d54d8a12b
Reviewed-on: https://review.whamcloud.com/30889
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_lov.c
lustre/lod/lod_qos.c

index e099a6c..18eba3e 100644 (file)
@@ -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);
 
index 91420d5..f554cf9 100644 (file)
@@ -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;