From 544fd725dc5773aa8fdd931e04eb51d658ee1686 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 1 Oct 2019 15:26:34 -0600 Subject: [PATCH] LU-12712 lod: fix warning message for non-SEL file The warning message printed when the LCME_FL_EXTENSION flag is set on a non-SEL file was incorrectly checking the component magic (usually LOV_MAGIC_V3) instead of the file magic (should be LOV_MAGIC_SEL). Don't redefine "magic" for each component, since this is only used in one other place to mean the component magic, and use the actual file or component magic in the few places where this is checked. Fix the warning message to be rate-limited on the console by using CWARN(...) instead of CDEBUG(D_WARNING, ...), though it is somewhat questionable whether this should be a console message at all as there is nothing that the administrator can do about this problem and it doesn't appear to have any side-effects. Also print the component ID/index and restructure the message text so that it is more clear about what the actual problem is. Fix a few minor style issues in nearby code. Test-Parameters: trivial testlist=sanity-pfl Signed-off-by: Andreas Dilger Change-Id: I81c3f9914512b1959b8483bb2b988ea4597cab07 Reviewed-on: https://review.whamcloud.com/36351 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vitaly Fertman Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/lod/lod_lov.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 3d04759..95bf0cc 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -1151,14 +1151,14 @@ out: int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, const struct lu_buf *buf) { - struct lov_mds_md_v1 *lmm; - struct lov_comp_md_v1 *comp_v1 = NULL; - struct lov_foreign_md *foreign = NULL; - struct lov_ost_data_v1 *objs; - __u32 magic, pattern; - int i, j, rc = 0; - __u16 comp_cnt; - __u16 mirror_cnt = 0; + struct lov_mds_md_v1 *lmm; + struct lov_comp_md_v1 *comp_v1 = NULL; + struct lov_foreign_md *foreign = NULL; + struct lov_ost_data_v1 *objs; + __u32 magic, pattern; + __u16 mirror_cnt = 0; + __u16 comp_cnt; + int i, rc; ENTRY; LASSERT(buf); @@ -1219,15 +1219,14 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, GOTO(out, rc); for (i = 0; i < comp_cnt; i++) { - struct lod_layout_component *lod_comp; - struct lu_extent *ext; - __u32 offs; + struct lod_layout_component *lod_comp; + struct lu_extent *ext; + __u32 offs; lod_comp = &lo->ldo_comp_entries[i]; if (lo->ldo_is_composite) { offs = le32_to_cpu(comp_v1->lcm_entries[i].lcme_offset); lmm = (struct lov_mds_md_v1 *)((char *)comp_v1 + offs); - magic = le32_to_cpu(lmm->lmm_magic); ext = &comp_v1->lcm_entries[i].lcme_extent; lod_comp->llc_extent.e_start = @@ -1243,16 +1242,16 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, if (lod_comp->llc_id == LCME_ID_INVAL) GOTO(out, rc = -EINVAL); - if (comp_v1->lcm_entries[i].lcme_flags & - cpu_to_le32(LCME_FL_EXTENSION) && - magic != LOV_MAGIC_SEL) { + if ((lod_comp->llc_flags & LCME_FL_EXTENSION) && + comp_v1->lcm_magic != cpu_to_le32(LOV_MAGIC_SEL)) { struct lod_device *d = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); - CDEBUG(D_WARNING, "%s: not SEL magic on SEL " - "file "DFID": %x\n", - lod2obd(d)->obd_name, - PFID(lod_object_fid(lo)), magic); + CWARN("%s: EXTENSION flags=%x set on component[%u]=%x of non-SEL file "DFID" with magic=%#08x\n", + lod2obd(d)->obd_name, + lod_comp->llc_flags, lod_comp->llc_id, i, + PFID(lod_object_fid(lo)), + le32_to_cpu(comp_v1->lcm_magic)); } } else { lod_comp_set_init(lod_comp); @@ -1267,8 +1266,9 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, lod_comp->llc_stripe_count = le16_to_cpu(lmm->lmm_stripe_count); lod_comp->llc_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); - if (magic == LOV_MAGIC_V3) { + if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V3)) { struct lov_mds_md_v3 *v3 = (struct lov_mds_md_v3 *)lmm; + lod_set_pool(&lod_comp->llc_pool, v3->lmm_pool_name); objs = &v3->lmm_objects[0]; } else { @@ -1284,6 +1284,8 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, __u16 stripe_count; if (objs[0].l_ost_idx != (__u32)-1UL) { + int j; + stripe_count = lod_comp_entry_stripe_count( lo, lod_comp, false); if (stripe_count == 0 && -- 1.8.3.1