Skip to content
Snippets Groups Projects
replay-single.sh 48.7 KiB
Newer Older
Nathan Rutman's avatar
Nathan Rutman committed
#!/bin/bash
Nathan Rutman's avatar
Nathan Rutman committed
#set -v
#
# This test needs to be run on the client
#
Wang Di's avatar
Wang Di committed
SAVE_PWD=$PWD
Robert Read's avatar
Robert Read committed
LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
Wang Di's avatar
Wang Di committed
SETUP=${SETUP:-}
CLEANUP=${CLEANUP:-}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
Nathan Rutman's avatar
Nathan Rutman committed
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
Wang Di's avatar
Wang Di committed
CHECK_GRANT=${CHECK_GRANT:-"yes"}
GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
Robert Read's avatar
 
Robert Read committed

Elena Gryaznova's avatar
Elena Gryaznova committed
remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0

Elena Gryaznova's avatar
Elena Gryaznova committed
# bug number:
Elena Gryaznova's avatar
Elena Gryaznova committed
ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT"
Elena Gryaznova's avatar
Elena Gryaznova committed
if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
    CONFIG_EXCEPTIONS="0b 42 47 61a 61c"
    echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
    echo "Except the tests: $CONFIG_EXCEPTIONS"
    ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
fi

Elena Gryaznova's avatar
Elena Gryaznova committed
#                                                  63 min  7 min  AT AT AT AT"
[ "$SLOW" = "no" ] && EXCEPT_SLOW="1 2 3 4 6 12 16 44a     44b    65 66 67 68"
Elena Gryaznova's avatar
Elena Gryaznova committed

Elena Gryaznova's avatar
Elena Gryaznova committed
check_and_setup_lustre
Elena Gryaznova's avatar
Elena Gryaznova committed
assert_DIR
Elena Gryaznova's avatar
Elena Gryaznova committed
rm -rf $DIR/[df][0-9]*

Elena Gryaznova's avatar
Elena Gryaznova committed
test_0a() {	# was test_0
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    fail mds
Elena Gryaznova's avatar
Elena Gryaznova committed
run_test 0a "empty replay"
test_0b() {
Elena Gryaznova's avatar
Elena Gryaznova committed
    remote_ost_nodsh && skip "remote OST with nodsh" && return 0

    # this test attempts to trigger a race in the precreation code, 
    # and must run before any other objects are created on the filesystem
Nathan Rutman's avatar
Nathan Rutman committed
    fail ost1
    createmany -o $DIR/$tfile 20 || return 1
    unlinkmany $DIR/$tfile 20 || return 2
}
run_test 0b "ensure object created after recover exists. (3284)"

Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile || return 1
    rm $DIR/$tfile
run_test 1 "simple create"
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile || return 1
    rm $DIR/$tfile
Elena Gryaznova's avatar
Elena Gryaznova committed
    mcreate $DIR/$tfile
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile || return 1
    rm $DIR/$tfile
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    mcreate $DIR/$tfile
    o_directory $DIR/$tfile
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile || return 2
    rm $DIR/$tfile
run_test 3a "replay failed open(O_DIRECTORY)"

test_3b() {
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
#define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
komaln's avatar
komaln committed
    do_facet mds "lctl set_param fail_loc=0x80000114"
    touch $DIR/$tfile
komaln's avatar
komaln committed
    do_facet mds "lctl set_param fail_loc=0"
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile && return 2
    return 0
}
run_test 3b "replay failed open -ENOMEM"

test_3c() {
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
#define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
komaln's avatar
komaln committed
    do_facet mds "lctl set_param fail_loc=0x80000128"
    touch $DIR/$tfile
komaln's avatar
komaln committed
    do_facet mds "lctl set_param fail_loc=0"
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds

    $CHECKSTAT -t file $DIR/$tfile && return 2
    return 0
}
run_test 3c "replay failed open -ENOMEM"
Elena Gryaznova's avatar
Elena Gryaznova committed
test_4a() {	# was test_4
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    for i in `seq 10`; do
        echo "tag-$i" > $DIR/$tfile-$i
    done 
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    for i in `seq 10`; do
      grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
Elena Gryaznova's avatar
Elena Gryaznova committed
run_test 4a "|x| 10 open(O_CREAT)s"
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
}
run_test 4b "|x| rm 10 files"

# The idea is to get past the first block of precreated files on both 
# osts, and then replay.
test_5() {
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    for i in `seq 220`; do
        echo "tag-$i" > $DIR/$tfile-$i
    done 
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    for i in `seq 220`; do
      grep -q "tag-$i" $DIR/$tfile-$i || error "f1c-$i"
    done 
    rm -rf $DIR/$tfile-*
    sleep 3
    # waiting for commitment of removal
}
run_test 5 "|x| 220 open(O_CREAT)"


Elena Gryaznova's avatar
Elena Gryaznova committed
test_6a() {	# was test_6
    mkdir -p $DIR/$tdir
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    mcreate $DIR/$tdir/$tfile
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t dir $DIR/$tdir || return 1
    $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
    sleep 2
    # waiting for log process thread
}
Elena Gryaznova's avatar
Elena Gryaznova committed
run_test 6a "mkdir + contained create"
Elena Gryaznova's avatar
Elena Gryaznova committed
    mkdir -p $DIR/$tdir
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t dir $DIR/$tdir && return 1 || true 
}
run_test 6b "|X| rmdir"

test_7() {
Elena Gryaznova's avatar
Elena Gryaznova committed
    mkdir -p $DIR/$tdir
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    mcreate $DIR/$tdir/$tfile
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    $CHECKSTAT -t dir $DIR/$tdir || return 1
    $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
    rm -fr $DIR/$tdir
}
run_test 7 "mkdir |X| contained create"

test_8() {
Nathan Rutman's avatar
Nathan Rutman committed
    replay_barrier mds
    multiop_bg_pause $DIR/$tfile mo_c || return 4
Nathan Rutman's avatar
Nathan Rutman committed
    fail mds
    ls $DIR/$tfile
    $CHECKSTAT -t file $DIR/$tfile || return 1
Loading
Loading full blame...