#!/bin/bash
+# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
set -e
SETUP=${SETUP:-}
CLEANUP=${CLEANUP:-}
MOUNT_2=${MOUNT_2:-"yes"}
+export MULTIOP=${MULTIOP:-multiop}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
# /tmp/multiop_bg.pid file
local pid_file=$TMP/multiop_bg.pid.$$
- do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= sh runmultiop_bg_pause $file $cmds" &
+ do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= runmultiop_bg_pause $file $cmds" &
local pid=$!
sleep 3
local multiop_pid
cos_param_file=$TMP/rvbr-cos-params
save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file
+test_0a() {
+ get_version $CLIENT1 $DIR/$tdir/1a || true
+}
+run_test 0a "getversion for non existent file shouldn't cause kernel panic"
+
+test_0b() {
+ local var=${SINGLEMDS}_svc
+ local fid
+ local file=$DIR/$tdir/f
+
+ do_node $CLIENT1 mkdir -p $DIR/$tdir/
+ do_node $CLIENT1 touch $file
+ fid=$(do_node $CLIENT1 $LFS path2fid $file)
+ do_node $CLIENT1 rm -rf $file
+ do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
+}
+run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
+
# test set #1: OPEN
test_1a() { # former test_0a
local file=$DIR/$tfile
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
- error "open succeeded unexpectedly"
+ error_and_remount "open succeeded unexpectedly"
fi
}
run_test 1b "open (O_CREAT) checks version of parent"
if (($pre != $post)); then
error "version was changed: pre $pre, post $post"
fi
- do_node $CLIENT1 rm $DIR/$tfile-*
+ # remote directory
+ if [ $MDSCOUNT -ge 2 ]; then
+ #create remote dir
+ local MDT_IDX=1
+ pre=$(get_version $CLIENT1 $DIR)
+ do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
+ post=$(get_version $CLIENT1 $DIR)
+ if (($pre != $post)); then
+ error "version was changed: pre $pre, post $post"
+ fi
+ fi
+ do_node $CLIENT1 rm -rf $DIR/$tfile-*
}
run_test 2a "create operations doesn't change version of parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
- error "create succeeded unexpectedly"
+ error_and_remount "create succeeded unexpectedly"
fi
}
run_test 2b "create checks version of parent"
if (($pre != $post)); then
error "version was changed: pre $pre, post $post"
fi
+
+ if [ $MDSCOUNT -ge 2 ]; then
+ #create remote dir
+ local MDT_IDX=1
+ do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
+ pre=$(get_version $CLIENT1 $DIR)
+ do_node $CLIENT1 rmdir $DIR/$tfile-remote_dir
+ post=$(get_version $CLIENT1 $DIR)
+ if (($pre != $post)); then
+ error "version was changed: pre $pre, post $post"
+ fi
+ fi
}
run_test 3a "unlink doesn't change version of parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
- error "unlink succeeded unexpectedly"
+ error_and_remount "unlink succeeded unexpectedly"
fi
}
run_test 3b "unlink checks version of parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
- error "setattr of UID succeeded unexpectedly"
+ error_and_remount "setattr of UID succeeded unexpectedly"
fi
}
run_test 4c "setattr of UID checks versions"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
- error "setattr of GID succeeded unexpectedly"
+ error_and_remount "setattr of GID succeeded unexpectedly"
fi
}
run_test 4d "setattr of GID checks versions"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
- error "setattr of permission succeeded unexpectedly"
+ error_and_remount "setattr of permission succeeded unexpectedly"
fi
}
run_test 4f "setattr of permission checks versions"
error "time not changed: pre $mtime_pre, post $mtime_post"
fi
if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
- error "setattr of size failed"
+ error_and_remount "setattr of size failed"
fi
mtime=$(do_node $CLIENT1 stat --format=%Y $file)
if (($mtime != $mtime_post)); then
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
- error "link should fail"
+ error_and_remount "link should fail"
fi
}
run_test 5b "link checks version of target parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
- error "link should fail"
+ error_and_remount "link should fail"
fi
}
run_test 5c "link checks version of source"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
- error "rename should fail"
+ error_and_remount "rename should fail"
fi
}
run_test 6c "rename checks version of source parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
- error "rename should fail"
+ error_and_remount "rename should fail"
fi
}
run_test 6d "rename checks version of target parent"
[ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
-complete $(basename $0) $SECONDS
+complete $SECONDS
check_and_cleanup_lustre
exit_status