In lod_use_defined_striping() covert layout magic to non _DEF form
before passing to lov_mds_md_size() and check that the supplied buffer
is sufficiently large only after accounting for released layouts.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ic5fdebaf0bc4a9327d6f5bba1be048bb033b1d3a
Reviewed-on: http://review.whamcloud.com/7467
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
magic = le32_to_cpu(v1->lmm_magic);
if (magic == LOV_MAGIC_V1_DEF) {
magic = le32_to_cpu(v1->lmm_magic);
if (magic == LOV_MAGIC_V1_DEF) {
objs = &v1->lmm_objects[0];
} else if (magic == LOV_MAGIC_V3_DEF) {
objs = &v1->lmm_objects[0];
} else if (magic == LOV_MAGIC_V3_DEF) {
objs = &v3->lmm_objects[0];
lod_object_set_pool(mo, v3->lmm_pool_name);
} else {
objs = &v3->lmm_objects[0];
lod_object_set_pool(mo, v3->lmm_pool_name);
} else {
mo->ldo_stripe_size = le32_to_cpu(v1->lmm_stripe_size);
mo->ldo_stripenr = le16_to_cpu(v1->lmm_stripe_count);
mo->ldo_layout_gen = le16_to_cpu(v1->lmm_layout_gen);
mo->ldo_stripe_size = le32_to_cpu(v1->lmm_stripe_size);
mo->ldo_stripenr = le16_to_cpu(v1->lmm_stripe_count);
mo->ldo_layout_gen = le16_to_cpu(v1->lmm_layout_gen);
- LASSERT(buf->lb_len >= lov_mds_md_size(mo->ldo_stripenr, magic));
/* fixup for released file before object initialization */
if (mo->ldo_pattern & LOV_PATTERN_F_RELEASED) {
/* fixup for released file before object initialization */
if (mo->ldo_pattern & LOV_PATTERN_F_RELEASED) {
+ LASSERT(buf->lb_len >= lov_mds_md_size(mo->ldo_stripenr, magic));
+
if (mo->ldo_stripenr > 0)
rc = lod_initialize_objects(env, mo, objs);
if (mo->ldo_stripenr > 0)
rc = lod_initialize_objects(env, mo, objs);