Whamcloud - gitweb
LU-15513 lod: iterate initialized stripe 28/47028/7
authorBobi Jam <bobijam@whamcloud.com>
Mon, 11 Apr 2022 08:46:32 +0000 (16:46 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 27 Jun 2022 04:37:47 +0000 (04:37 +0000)
Fix an array out of bounds access.

Do not iterate over the component objects in lod_fill_mirrors() to
check non-rotational OSTs if the component is unintialized or it is
a MDT or RELEASED component.

Fixes: 591a990c61 ("LU-15513 lod: skip uninit component in lod_fill_mirrors")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I8530cd30fab750c47f15ee9278ec6d68871367cc
Reviewed-on: https://review.whamcloud.com/47028
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_lov.c

index 8d87e4d..5444c63 100644 (file)
@@ -610,7 +610,9 @@ int lod_fill_mirrors(struct lod_object *lo)
        for (i = 0; i < lo->ldo_comp_cnt; i++, lod_comp++) {
                bool stale = lod_comp->llc_flags & LCME_FL_STALE;
                bool preferred = lod_comp->llc_flags & LCME_FL_PREF_WR;
-               bool init = lod_comp_inited(lod_comp);
+               bool init = (lod_comp->llc_stripe != NULL) &&
+                           !(lod_comp->llc_pattern & LOV_PATTERN_F_RELEASED) &&
+                           !(lod_comp->llc_pattern & LOV_PATTERN_MDT);
                int j;
 
                pref = 0;
@@ -619,7 +621,10 @@ int lod_fill_mirrors(struct lod_object *lo)
                        __u32 idx = lod_comp->llc_ost_indices[j];
                        struct lod_tgt_desc *ltd;
 
-                       if (unlikely(idx > lod->lod_ost_descs.ltd_tgts_size)) {
+                       if (lod_comp->llc_stripe[j] == NULL)
+                               continue;
+
+                       if (unlikely(idx >= lod->lod_ost_descs.ltd_tgts_size)) {
                                CERROR("%s: "DFID" OST idx %u > max %u\n",
                                       lod2obd(lod)->obd_name,
                                       PFID(lu_object_fid(&lo->ldo_obj.do_lu)),