From: wangchao Date: Wed, 10 Dec 2003 07:05:25 +0000 (+0000) Subject: b=2237 X-Git-Tag: 1.0.2~78 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=7e024fd134c060e03c13145cfa88c692462209e2;p=fs%2Flustre-release.git b=2237 r=phil lstripe should fail when offset > numobd --- diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index db9ae6a..2cf14fd 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -474,6 +474,13 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, lum.lmm_stripe_size, PAGE_SIZE); RETURN(-EINVAL); } + + if ((lum.lmm_stripe_offset >= lov->desc.ld_active_tgt_count) && + (lum.lmm_stripe_offset != (typeof(lum.lmm_stripe_offset))(-1))) { + CDEBUG(D_IOCTL, "stripe offset %u > number of active OSTs %u\n", + lum.lmm_stripe_offset, lov->desc.ld_active_tgt_count); + RETURN(-EINVAL); + } stripe_count = lov_get_stripecnt(lov, lum.lmm_stripe_count); if ((__u64)lum.lmm_stripe_size * stripe_count > ~0UL) { diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fc4af06..6216a42 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -728,6 +728,14 @@ test_27g() { } run_test 27g "test lfind =======================================" +test_27j() { + if [ ! -d $DIR/d27 ]; then + mkdir $DIR/d27 + fi + $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true +} +run_test 27j "lstripe with bad stripe offset (should return error)" + test_28() { mkdir $DIR/d28 $CREATETEST $DIR/d28/ct || error