From: bwzhou Date: Tue, 6 Nov 2007 10:02:59 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_7_0_51~533 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=67d8e01d2455677606046f50bcf1b4a07316b804 Branch HEAD b=13933 i=adilger i=johann Set an upper limit for stripe count --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 5495b11..2a39b48 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1462,6 +1462,7 @@ enum seq_op { #define LOV_MIN_STRIPE_SIZE 65536 /* maximum PAGE_SIZE (ia64), power of 2 */ #define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */ +#define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */ #define LOV_MAX_UUID_BUFFER_SIZE 8192 /* The size of the buffer the lov/mdc reserves for the diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 4a9f996..3c4ac5b 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -51,7 +51,7 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, int stripe_count) { - if (stripe_count == 0) { + if (stripe_count == 0 || stripe_count > LOV_V1_INSANE_STRIPE_COUNT) { CERROR("bad stripe count %d\n", stripe_count); lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index c4cf957..b13a067 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -48,12 +48,20 @@ void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) CDEBUG(level,"stripe_size %u, stripe_count %u\n", le32_to_cpu(lmm->lmm_stripe_size), le32_to_cpu(lmm->lmm_stripe_count)); - for (i = 0, lod = lmm->lmm_objects; - i < (int)le32_to_cpu(lmm->lmm_stripe_count); i++, lod++) - CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n", - i, le32_to_cpu(lod->l_ost_idx), - le64_to_cpu(lod->l_object_gr), - le64_to_cpu(lod->l_object_id)); + + if (le32_to_cpu(lmm->lmm_stripe_count) <= LOV_V1_INSANE_STRIPE_COUNT) { + for (i = 0, lod = lmm->lmm_objects; + i < (int)le32_to_cpu(lmm->lmm_stripe_count); i++, lod++) + CDEBUG(level, + "stripe %u idx %u subobj "LPX64"/"LPX64"\n", + i, le32_to_cpu(lod->l_ost_idx), + le64_to_cpu(lod->l_object_gr), + le64_to_cpu(lod->l_object_id)); + } else { + CDEBUG(level, "bad stripe_count %u > max_stripe_count %u\n", + le32_to_cpu(lmm->lmm_stripe_count), + LOV_V1_INSANE_STRIPE_COUNT); + } } void lov_dump_lmm_join(int level, struct lov_mds_md_join *lmmj)