Whamcloud - gitweb
LU-12712 lod: fix warning message for non-SEL file 51/36351/3
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 1 Oct 2019 21:26:34 +0000 (15:26 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 9 Oct 2019 22:35:40 +0000 (22:35 +0000)
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 <adilger@whamcloud.com>
Change-Id: I81c3f9914512b1959b8483bb2b988ea4597cab07
Reviewed-on: https://review.whamcloud.com/36351
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Vitaly Fertman <c17818@cray.com>
Reviewed-by: Patrick Farrell <farr0186@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_lov.c

index 3d04759..95bf0cc 100644 (file)
@@ -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 &&