From cff25691fa85d4a613f4f6477ad8c03f7f0c39a5 Mon Sep 17 00:00:00 2001 From: dzogin Date: Tue, 10 Nov 2009 15:22:49 +0000 Subject: [PATCH] Branch b1_8 b=21049 i=adilger i=robert.read ---------------------------------------------------------------------- Modified Files: Tag: b1_8 lustre/ChangeLog lustre/obdfilter/filter.c lustre/ost/ost_handler.c lustre/tests/sanity.sh lustre/tests/test-framework.sh ---------------------------------------------------------------------- --- lustre/ChangeLog | 6 +++ lustre/obdfilter/filter.c | 11 +++++ lustre/ost/ost_handler.c | 6 +-- lustre/tests/sanity.sh | 94 ++++++++++++++++++++++-------------------- lustre/tests/test-framework.sh | 2 +- 5 files changed, 68 insertions(+), 51 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index b901507..d4ead2c 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -10,6 +10,12 @@ tbd Sun Microsystems, Inc. 2.6.16 - 2.6.30 vanilla (kernel.org) * Recommended e2fsprogs version: 1.41.6.sun1 +Severity : normal +Bugzilla : 21049 +Description: Sanity test_27p fails. +Details : OBD_FAIL_OST_ENOSPC has been moved to filter_statfs(). + Sanity tests 27 were cleaned up and improved. + Severity : enhancement Bugzilla : 19325 Description: Adjust locks' extents on their first enqueue, so that at the time diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 56a40fb..230ec26e 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3208,6 +3208,17 @@ static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs, ((filter->fo_tot_dirty + filter->fo_tot_pending + osfs->os_bsize - 1) >> blockbits)); + if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOSPC)) { + struct lr_server_data *lsd = filter->fo_fsd; + int index = le32_to_cpu(lsd->lsd_ost_index); + + if (obd_fail_val == -1 || + index == obd_fail_val) + osfs->os_bfree = osfs->os_bavail = 2; + else if (obd_fail_loc & OBD_FAIL_ONCE) + obd_fail_loc &= ~OBD_FAILED; /* reset flag */ + } + /* set EROFS to state field if FS is mounted as RDONLY. The goal is to * stop creating files on MDS if OST is not good shape to create * objects.*/ diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 5e0f3d9..5b0fd15 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -179,8 +179,6 @@ static int ost_statfs(struct ptlrpc_request *req) req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, cfs_time_current_64() - HZ, 0); - if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC)) - osfs->os_bfree = osfs->os_bavail = 64; if (req->rq_status != 0) CERROR("ost: statfs failed: rc %d\n", req->rq_status); @@ -1824,8 +1822,6 @@ static int ost_handle(struct ptlrpc_request *req) CDEBUG(D_INODE, "create\n"); OBD_FAIL_RETURN(OBD_FAIL_OST_CREATE_NET, 0); OBD_FAIL_TIMEOUT_MS(OBD_FAIL_OST_PAUSE_CREATE, obd_fail_val); - if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC)) - GOTO(out, rc = -ENOSPC); if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS)) GOTO(out, rc = -EROFS); rc = ost_create(req->rq_export, req, oti); @@ -1858,7 +1854,7 @@ static int ost_handle(struct ptlrpc_request *req) GOTO(out, rc = -EPROTO); } OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0); - if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC)) + if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOSPC)) GOTO(out, rc = -ENOSPC); if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS)) GOTO(out, rc = -EROFS); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index ad6a1f7..34593bf0 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -951,18 +951,19 @@ sleep_maxage() { # OSCs keep a NOSPC flag that will be reset after ~5s (qos_maxage) # if the OST isn't full anymore. reset_enospc() { - local FAIL_LOC=${1:-0} - local OSTIDX=${2:-""} + local OSTIDX=${1:-""} local list=$(comma_list $(osts_nodes)) [ "$OSTIDX" ] && list=$(facet_host ost$((OSTIDX + 1))) - do_nodes $list lctl set_param fail_loc=$FAIL_LOC + do_nodes $list lctl set_param fail_loc=0 sleep_maxage } exhaust_precreations() { local OSTIDX=$1 + local FAILLOC=$2 + local FAILIDX=${3:-$OSTIDX} local OST=$(lfs osts | grep ${OSTIDX}": " | \ awk '{print $2}' | sed -e 's/_UUID$//') @@ -972,22 +973,23 @@ exhaust_precreations() { local last_id=$(do_facet mds lctl get_param -n osc.$mdtosc.prealloc_last_id) local next_id=$(do_facet mds lctl get_param -n osc.$mdtosc.prealloc_next_id) - mkdir -p $DIR/d27/${OST} - $SETSTRIPE $DIR/d27/${OST} -i $OSTIDX -c 1 + mkdir -p $DIR/$tdir/${OST} + $SETSTRIPE $DIR/$tdir/${OST} -i $OSTIDX -c 1 #define OBD_FAIL_OST_ENOSPC 0x215 + do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=$FAILIDX do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x215 echo "Creating to objid $last_id on ost $OST..." - createmany -o $DIR/d27/${OST}/f $next_id $((last_id - next_id + 2)) + createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2)) do_facet mds "lctl get_param -n osc.$mdtosc.prealloc*" | grep '[0-9]' - reset_enospc $2 $OSTIDX + do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=$FAILLOC + sleep_maxage } exhaust_all_precreations() { local i for (( i=0; i < OSTCOUNT; i++ )) ; do - exhaust_precreations $i 0x215 + exhaust_precreations $i $1 -1 done - reset_enospc $1 } test_27n() { @@ -996,11 +998,11 @@ test_27n() { remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc - rm -f $DIR/d27/f27n + rm -f $DIR/$tdir/$tfile exhaust_precreations 0 0x80000215 - $SETSTRIPE -c -1 $DIR/d27 - touch $DIR/d27/f27n || error - $GETSTRIPE $DIR/d27/f27n + $SETSTRIPE -c -1 $DIR/$tdir + touch $DIR/$tdir/$tfile || error + $GETSTRIPE $DIR/$tdir/$tfile reset_enospc } run_test 27n "create file with some full OSTs ==================" @@ -1011,12 +1013,13 @@ test_27o() { remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc - rm -f $DIR/d27/f27o + rm -f $DIR/$tdir/$tfile exhaust_all_precreations 0x215 - touch $DIR/d27/f27o && error "able to create $DIR/d27/f27o" + touch $DIR/$tdir/$tfile && error "able to create $DIR/$tdir/$tfile" reset_enospc + rm -rf $DIR/$tdir/* } run_test 27o "create file with all full OSTs (should error) ====" @@ -1026,16 +1029,16 @@ test_27p() { remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc - rm -f $DIR/d27/f27p - mkdir -p $DIR/d27 + rm -f $DIR/$tdir/$tfile + mkdir -p $DIR/$tdir - $MCREATE $DIR/d27/f27p || error - $TRUNCATE $DIR/d27/f27p 80000000 || error - $CHECKSTAT -s 80000000 $DIR/d27/f27p || error + $MCREATE $DIR/$tdir/$tfile || error + $TRUNCATE $DIR/$tdir/$tfile 80000000 || error + $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error exhaust_precreations 0 0x80000215 - echo foo >> $DIR/d27/f27p || error - $CHECKSTAT -s 80000004 $DIR/d27/f27p || error + echo foo >> $DIR/$tdir/$tfile || error + $CHECKSTAT -s 80000004 $DIR/$tdir/$tfile || error reset_enospc } @@ -1047,16 +1050,16 @@ test_27q() { remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc - rm -f $DIR/d27/f27q + rm -f $DIR/$tdir/$tfile - $MCREATE $DIR/d27/f27q || error "mcreate $DIR/d27/f27q failed" - $TRUNCATE $DIR/d27/f27q 80000000 ||error "truncate $DIR/d27/f27q failed" - $CHECKSTAT -s 80000000 $DIR/d27/f27q || error "checkstat failed" + $MCREATE $DIR/$tdir/$tfile || error "mcreate $DIR/$tdir/$tfile failed" + $TRUNCATE $DIR/$tdir/$tfile 80000000 ||error "truncate $DIR/$tdir/$tfile failed" + $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error "checkstat failed" exhaust_all_precreations 0x215 - echo foo >> $DIR/d27/f27q && error "append succeeded" - $CHECKSTAT -s 80000000 $DIR/d27/f27q || error "checkstat 2 failed" + echo foo >> $DIR/$tdir/$tfile && error "append succeeded" + $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error "checkstat 2 failed" reset_enospc } @@ -1068,10 +1071,10 @@ test_27r() { remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc - rm -f $DIR/d27/f27r + rm -f $DIR/$tdir/$tfile exhaust_precreations 0 0x80000215 - $SETSTRIPE $DIR/d27/f27r -i 0 -c 2 # && error + $SETSTRIPE $DIR/$tdir/$tfile -i 0 -c 2 # && error reset_enospc } @@ -1104,14 +1107,14 @@ test_27u() { # bug 4900 #define OBD_FAIL_MDS_OSC_PRECREATE 0x139 do_facet mds lctl set_param fail_loc=0x139 - mkdir -p $DIR/d27u - createmany -o $DIR/d27u/t- 1000 + mkdir -p $DIR/$tdir + createmany -o $DIR/$tdir/t- 1000 do_facet mds lctl set_param fail_loc=0 TLOG=$DIR/$tfile.getstripe - $GETSTRIPE $DIR/d27u > $TLOG + $GETSTRIPE $DIR/$tdir > $TLOG OBJS=`awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj;}' $TLOG` - unlinkmany $DIR/d27u/t- 1000 + unlinkmany $DIR/$tdir/t- 1000 [ $OBJS -gt 0 ] && \ error "$OBJS objects created on OST-0. See $TLOG" || pass } @@ -1122,7 +1125,8 @@ test_27v() { # bug 4900 remote_mds_nodsh && skip "remote MDS with nodsh" && return remote_ost_nodsh && skip "remote OST with nodsh" && return - exhaust_all_precreations + exhaust_all_precreations 0x215 + reset_enospc mkdir -p $DIR/$tdir $SETSTRIPE $DIR/$tdir -c 1 # 1 stripe / file @@ -1146,18 +1150,18 @@ test_27v() { # bug 4900 run_test 27v "skip object creation on slow OST =================" test_27w() { # bug 10997 - mkdir -p $DIR/d27w || error "mkdir failed" - $SETSTRIPE $DIR/d27w/f0 -s 65536 || error "lstripe failed" - size=`$GETSTRIPE $DIR/d27w/f0 -qs` + mkdir -p $DIR/$tdir || error "mkdir failed" + $SETSTRIPE $DIR/$tdir/f0 -s 65536 || error "lstripe failed" + size=`$GETSTRIPE $DIR/$tdir/f0 -qs` [ $size -ne 65536 ] && error "stripe size $size != 65536" || true [ "$OSTCOUNT" -lt "2" ] && skip_env "skipping multiple stripe count/offset test" && return for i in `seq 1 $OSTCOUNT`; do offset=$(($i-1)) - log setstripe $DIR/d27w/f$i -c $i -i $offset - $SETSTRIPE $DIR/d27w/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed" - count=`$GETSTRIPE -qc $DIR/d27w/f$i` - index=`$GETSTRIPE -qo $DIR/d27w/f$i` + log setstripe $DIR/$tdir/f$i -c $i -i $offset + $SETSTRIPE $DIR/$tdir/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed" + count=`$GETSTRIPE -qc $DIR/$tdir/f$i` + index=`$GETSTRIPE -qo $DIR/$tdir/f$i` [ $count -ne $i ] && error "stripe count $count != $i" || true [ $index -ne $offset ] && error "stripe offset $index != $offset" || true done @@ -1166,20 +1170,20 @@ run_test 27w "check lfs setstripe -c -s -i options =============" test_27x() { [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs" && return - OFFSET=$(($OSTCOUNTi - 1)) + OFFSET=$(($OSTCOUNT - 1)) OSTIDX=0 local OST=$(lfs osts | awk '/'${OSTIDX}': / { print $2 }' | sed -e 's/_UUID$//') mkdir -p $DIR/$tdir $SETSTRIPE $DIR/$tdir -c 1 # 1 stripe per file - do_facet ost$OSTIDX lctl set_param -n obdfilter.$OST.degraded 1 + do_facet ost$((OSTIDX + 1)) lctl set_param -n obdfilter.$OST.degraded 1 sleep_maxage createmany -o $DIR/$tdir/$tfile $OSTCOUNT for i in `seq 0 $OFFSET`; do [ `$GETSTRIPE $DIR/$tdir/$tfile$i | grep -A 10 obdidx | awk '{print $1}' | grep -w "$OSTIDX"` ] && error "OST0 was degraded but new created file still use it" done - do_facet ost$OSTIDX lctl set_param -n obdfilter.$OST.degraded 0 + do_facet ost$((OSTIDX + 1)) lctl set_param -n obdfilter.$OST.degraded 0 } run_test 27x "create files while OST0 is degraded" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 682cf82..ad81ca4 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1943,7 +1943,6 @@ debugrestore() { error_noexit() { local TYPE=${TYPE:-"FAIL"} local ERRLOG - lctl set_param fail_loc=0 2>/dev/null || true local dump=true # do not dump logs if $1=false @@ -1967,6 +1966,7 @@ error_noexit() { error() { error_noexit "$@" + reset_fail_loc $FAIL_ON_ERROR && exit 1 || true } -- 1.8.3.1