Newer
Older
#
# This test needs to be run on the client
#
LUSTRE=${LUSTRE:-`dirname $0`/..}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
# bug number: 4176
ALWAYS_EXCEPT="39 $REPLAY_SINGLE_EXCEPT"
gen_config() {
rm -f $XMLCONFIG
add_mds mds --dev $MDSDEV --size $MDSSIZE
if [ ! -z "$mdsfailover_HOST" ]; then
add_mdsfailover mds --dev $MDSDEV --size $MDSSIZE
add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
--stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
add_ost ost --lov lov1 --dev `ostdevname 1` --size $OSTSIZE
add_ost ost2 --lov lov1 --dev `ostdevname 2` --size $OSTSIZE
build_test_filter
SETUP=${SETUP:-"setup"}
CLEANUP=${CLEANUP:-"cleanupall"}
if [ "$ONLY" == "cleanup" ]; then
if [ "$ONLY" == "setup" ]; then
exit 0
fi
mkdir -p $DIR
test_0() {
run_test 0 "empty replay"
test_0b() {
# this test attempts to trigger a race in the precreation code,
# and must run before any other objects are created on the filesystem
createmany -o $DIR/$tfile 20 || return 1
unlinkmany $DIR/$tfile 20 || return 2
}
run_test 0b "ensure object created after recover exists. (3284)"
$CHECKSTAT -t file $DIR/$tfile || return 1
rm $DIR/$tfile
run_test 1 "simple create"
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
test_1a() {
do_facet ost1 "sysctl -w lustre.fail_loc=0"
rm -fr $DIR/$tfile
local old_last_id=`cat $LPROC/obdfilter/*/last_id`
touch -o $DIR/$tfile 1
sync
local new_last_id=`cat $LPROC/obdfilter/*/last_id`
test "$old_last_id" = "$new_last_id" || {
echo "OST object create is caused by MDS"
return 1
}
old_last_id=`cat $LPROC/obdfilter/*/last_id`
echo "data" > $DIR/$tfile
sync
new_last_id=`cat $LPROC/obdfilter/*/last_id`
test "$old_last_id" = "$new_last_id "&& {
echo "CROW does not work on write"
return 1
}
rm -fr $DIR/$tfile
#define OBD_FAIL_OST_CROW_EIO | OBD_FAIL_ONCE
do_facet ost1 "sysctl -w lustre.fail_loc=0x80000801"
rm -fr $DIR/1a1
old_last_id=`cat $LPROC/obdfilter/*/last_id`
echo "data" > $DIR/1a1
sync
new_last_id=`cat $LPROC/obdfilter/*/last_id`
test "$old_last_id" = "$new_last_id" || {
echo "CROW does work with fail_loc=0x80000801"
return 1
}
rm -fr $DIR/1a1
do_facet ost1 "sysctl -w lustre.fail_loc=0"
}
#CROW run_test 1a "CROW object create (check OST last_id)"
$CHECKSTAT -t file $DIR/$tfile || return 1
rm $DIR/$tfile
run_test 2a "touch"
test_2b() {
./mcreate $DIR/$tfile
$CHECKSTAT -t file $DIR/$tfile || return 1
rm $DIR/$tfile
run_test 2b "touch"
mcreate $DIR/$tfile
o_directory $DIR/$tfile
$CHECKSTAT -t file $DIR/$tfile || return 2
rm $DIR/$tfile
run_test 3a "replay failed open(O_DIRECTORY)"
test_3b() {
#define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
do_facet mds "sysctl -w lustre.fail_loc=0x80000114"
touch $DIR/$tfile
do_facet mds "sysctl -w lustre.fail_loc=0"
$CHECKSTAT -t file $DIR/$tfile && return 2
return 0
}
run_test 3b "replay failed open -ENOMEM"
test_3c() {
#define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
do_facet mds "sysctl -w lustre.fail_loc=0x80000128"
touch $DIR/$tfile
do_facet mds "sysctl -w lustre.fail_loc=0"
$CHECKSTAT -t file $DIR/$tfile && return 2
return 0
}
run_test 3c "replay failed open -ENOMEM"
for i in `seq 10`; do
echo "tag-$i" > $DIR/$tfile-$i
done
for i in `seq 10`; do
grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
done
}
run_test 4 "|x| 10 open(O_CREAT)s"
test_4b() {
rm -rf $DIR/$tfile-*
$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
Loading
Loading full blame...