From 73445b1142da4d3985cc79bcb44137c9e2b1fd8f Mon Sep 17 00:00:00 2001 From: liuy Date: Tue, 14 Aug 2007 04:42:07 +0000 Subject: [PATCH] Branch HEAD b=11679 i=adilger, deen fix lstripe failure with valid OST index --- lustre/ChangeLog | 6 ++++++ lustre/lov/lov_pack.c | 6 +++--- lustre/tests/sanity.sh | 29 +++++++++++++++++++++++++++++ lustre/tests/test-framework.sh | 12 ++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 7331230..d505e88 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -84,6 +84,12 @@ Frequency : rare Description: Oops in read and write path when failing to allocate lock. Details : Check if lock allocation failed and return error back. +Severity : normal +Bugzilla : 11679 +Description: lstripe command fails for valid OST index +Details : The stripe offset is compared to lov->desc.ld_tgt_count + instead of lov->desc.ld_active_tgt_count. + -------------------------------------------------------------------------------- 2007-08-10 Cluster File Systems, Inc. diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index f0c84bb..ca7e367 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -319,10 +319,10 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, lum.lmm_stripe_size = LOV_MIN_STRIPE_SIZE; } - if ((lum.lmm_stripe_offset >= lov->desc.ld_active_tgt_count) && + if ((lum.lmm_stripe_offset >= lov->desc.ld_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); + CDEBUG(D_IOCTL, "stripe offset %u > number of OSTs %u\n", + lum.lmm_stripe_offset, lov->desc.ld_tgt_count); RETURN(-EINVAL); } stripe_count = lov_get_stripecnt(lov, lum.lmm_stripe_count); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index dc89ce9..dc8f270 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2794,6 +2794,35 @@ test_65j() { # bug6367 } run_test 65j "set default striping on root directory (bug 6367)=" +test_65k() { # bug11679 + [ "$OSTCOUNT" -lt 2 ] && skip "too few OSTs" && return + + echo "Check OST status: " + MDS_OSCS=`do_facet mds lctl dl | awk '/[oO][sS][cC].*md[ts]/ { print $4 }'` + for OSC in $MDS_OSCS; do + echo $OSC "is activate" + do_facet mds lctl --device %$OSC activate + done + mkdir -p $DIR/$tdir + for INACTIVE_OSC in $MDS_OSCS; do + echo $INACTIVE_OSC "is Deactivate:" + do_facet mds lctl --device %$INACTIVE_OSC deactivate + for STRIPE_OSC in $MDS_OSCS; do + STRIPE_OST=`osc_to_ost $STRIPE_OSC` + STRIPE_INDEX=`do_facet mds cat $LPROC/lov/*md*/target_obd | + grep $STRIPE_OST | awk -F: '{print $1}'` + echo "$SETSTRIPE $DIR/$tdir/${STRIPE_INDEX} 0 ${STRIPE_INDEX} 1" + do_facet mds $SETSTRIPE $DIR/$tdir/${STRIPE_INDEX} 0 ${STRIPE_INDEX} 1 + RC=$? + [ $RC -ne 0 ] && error "setstripe should have succeeded" + done + rm -f $DIR/$tdir/* + echo $INACTIVE_OSC "is Activate." + do_facet mds lctl --device %$INACTIVE_OSC activate + done +} +run_test 65k "validate manual striping works properly with deactivated OSCs" + # bug 2543 - update blocks count on client test_66() { COUNT=${COUNT:-8} diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 37864d5..5769f4b 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1056,3 +1056,15 @@ canonical_path() { (cd `dirname $1`; echo $PWD/`basename $1`) } +######################## +# helper functions + +osc_to_ost() +{ + osc=$1 + ost=`echo $1 | awk -F_ '{print $3}'` + if [ -z $ost ]; then + ost=`echo $1 | sed 's/-osc.*//'` + fi + echo $ost +} -- 1.8.3.1