From: johann Date: Mon, 6 Oct 2008 12:24:22 +0000 (+0000) Subject: Branch b1_8_gate X-Git-Tag: v1_7_120~1^91~2 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b9651604ecde991480f8eaf27bd35313405c7c0a;p=fs%2Flustre-release.git Branch b1_8_gate b=17261 i=adilger i=shadow cap lmm_size to LOV_MAX_STRIPE_COUNT. --- diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 1bebe5c..08e8507 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -162,7 +162,7 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, struct lov_mds_md_v1 *lmmv1; struct lov_mds_md_v3 *lmmv3; struct lov_oinfo *loi; - int stripe_count = lov->desc.ld_tgt_count; + int stripe_count; struct lov_ost_data_v1 *lmm_objects; int lmm_size, lmm_magic; int i; @@ -178,11 +178,19 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, } else { stripe_count = lsm->lsm_stripe_count; } - } else if (lmmp && *lmmp) { - lmm_magic = le32_to_cpu((*lmmp)->lmm_magic); } else { - /* lsm == NULL and lmmp == NULL */ - lmm_magic = LOV_MAGIC; + /* No needs to allocated more than LOV_MAX_STRIPE_COUNT. + * Anyway, this is pretty inaccurate since ld_tgt_count now + * represents max index and we should rely on the actual number + * of OSTs instead */ + stripe_count = min(LOV_MAX_STRIPE_COUNT, + lov->desc.ld_tgt_count); + + if (lmmp && *lmmp) + lmm_magic = le32_to_cpu((*lmmp)->lmm_magic); + else + /* lsm == NULL and lmmp == NULL */ + lmm_magic = LOV_MAGIC; } if ((lmm_magic != LOV_MAGIC_V1) &&