set -e
-# bug number: 16356
-ALWAYS_EXCEPT="2 $REPLAY_VBR_EXCEPT"
+# bug number: 16356
+ALWAYS_EXCEPT="2 3c 4b 4c 10 $REPLAY_VBR_EXCEPT"
SAVE_PWD=$PWD
PTLDEBUG=${PTLDEBUG:--1}
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-
[ -n "$CLIENTS" ] || { skip_env "Need two or more clients" && exit 0; }
[ $CLIENTCOUNT -ge 2 ] || \
- { skip_env "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
-
+ { skip_env "Need two or more remote clients, have $CLIENTCOUNT" && exit 0; }
remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
+
+[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
+
+
[ ! "$NAME" = "ncli" ] && ALWAYS_EXCEPT="$ALWAYS_EXCEPT"
[ "$NAME" = "ncli" ] && MOUNT_2=""
MOUNT_2=""
}
get_version() {
- local var=${SINGLEMDS}_svc
local client=$1
local file=$2
local fid
fid=$(do_node $client $LFS path2fid $file)
- do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion $fid
+ do_facet mds $LCTL --device $mds_svc getobjversion $fid
}
+# interop 18 <-> 20
+lustre_version=$(get_lustre_version mds)
+if [[ $lustre_version != 1.8* ]]; then
+ mds20="yes"
+fi
+
test_0a() {
local file=$DIR/$tfile
local pre
error "version changed unexpectedly: pre $pre, post $post"
fi
}
-run_test 0a "open and close do not change versions"
+run_test 0a "VBR: open and close do not change versions"
test_0b() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
error "open succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0b "open (O_CREAT) checks version of parent"
+run_test 0b "VBR: open (O_CREAT) checks version of parent"
test_0c() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT2 chmod 666 $DIR/$tdir/$tfile
rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
+ client_up $CLIENT1 || error "$CLIENT1 evicted"
- do_node $CLIENT1 df $MOUNT || error "$CLIENT1 evicted"
rmultiop_stop $CLIENT1 || error "close failed"
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0c "open (non O_CREAT) does not checks versions"
+run_test 0c "VBR: open (non O_CREAT) does not checks versions"
test_0d() {
local pre
do_node $CLIENT1 mkfifo $DIR/$tfile
post=$(get_version $CLIENT1 $DIR)
if (($pre == $post)); then
- error "version not changed: pre $pre, post $post"
+ [ -n "$mds20" ] || error "version not changed: pre $pre, post $post"
fi
}
-run_test 0d "create changes version of parent"
+run_test 0d "VBR: create changes version of parent"
test_0e() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
error "create succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0e "create checks version of parent"
+run_test 0e "VBR: create checks version of parent"
test_0f() {
local pre
do_node $CLIENT1 rm $DIR/$tfile
post=$(get_version $CLIENT1 $DIR)
if (($pre == $post)); then
- error "version not changed: pre $pre, post $post"
+ [ -n "$mds20" ] || error "version not changed: pre $pre, post $post"
fi
}
-run_test 0f "unlink changes version of parent"
+run_test 0f "VBR: unlink changes version of parent"
test_0g() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT1 rm $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
error "unlink succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0g "unlink checks version of parent"
+run_test 0g "VBR: unlink checks version of parent"
test_0h() {
local file=$DIR/$tfile
error "version not changed: pre $pre, post $post"
fi
}
-run_test 0h "setattr of UID changes versions"
+run_test 0h "VBR: setattr of UID changes versions"
test_0i() {
local file=$DIR/$tfile
error "version not changed: pre $pre, post $post"
fi
}
-run_test 0i "setattr of GID changes versions"
+run_test 0i "VBR: setattr of GID changes versions"
test_0j() {
local file=$DIR/$tfile
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mcreate $file
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chown :$RUNAS_ID $file
do_node $CLIENT1 chown $RUNAS_ID $file
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
error "setattr of UID succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0j "setattr of UID checks versions"
+run_test 0j "VBR: setattr of UID checks versions"
test_0k() {
local file=$DIR/$tfile
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mcreate $file
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chown $RUNAS_ID $file
do_node $CLIENT1 chown :$RUNAS_ID $file
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
error "setattr of GID succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0k "setattr of GID checks versions"
+run_test 0k "VBR: setattr of GID checks versions"
test_0l() {
local file=$DIR/$tfile
error "version not changed: pre $pre, post $post"
fi
}
-run_test 0l "setattr of permission changes versions"
+run_test 0l "VBR: setattr of permission changes versions"
test_0m() {
local file=$DIR/$tfile
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chown :$RUNAS_ID $file
do_node $CLIENT1 chmod 666 $file
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
error "setattr of permission succeeded unexpectedly"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0m "setattr of permission checks versions"
+run_test 0m "VBR: setattr of permission checks versions"
test_0n() {
local file=$DIR/$tfile
error "version not changed: pre $pre, post $post"
fi
}
-run_test 0n "setattr of flags changes versions"
+run_test 0n "VBR: setattr of flags changes versions"
checkattr() {
local client=$1
test_0o() {
local file=$DIR/$tfile
local rc
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 666 $file
do_node $CLIENT1 chattr +i $file
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
checkattr $CLIENT1 i $file
rc=$?
do_node $CLIENT1 chattr -i $file
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0o "setattr of flags checks versions"
+run_test 0o "VBR: setattr of flags checks versions"
test_0p() {
local file=$DIR/$tfile
local pre
local post
local ad_orig
- local var=${SINGLEMDS}_svc
- ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
+ ad_orig=$(do_facet mds "$LCTL get_param *.${mds_svc}.atime_diff")
+ do_facet mds "$LCTL set_param *.${mds_svc}.atime_diff=0"
do_node $CLIENT1 mcreate $file
pre=$(get_version $CLIENT1 $file)
do_node $CLIENT1 touch $file
# We don't fail MDS in this test. atime_diff shall be
# restored to its original value.
#
- do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
+ do_facet mds "$LCTL set_param $ad_orig"
if (($pre != $post)); then
error "version changed unexpectedly: pre $pre, post $post"
fi
}
-run_test 0p "setattr of times does not change versions"
+run_test 0p "VBR: setattr of times does not change versions"
test_0q() {
local file=$DIR/$tfile
error "version changed unexpectedly: pre $pre, post $post"
fi
}
-run_test 0q "setattr of size does not change versions"
+run_test 0q "VBR: setattr of size does not change versions"
test_0r() {
local file=$DIR/$tfile
local mtime_pre
local mtime_post
local mtime
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.atime_diff=0"
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 666 $file
do_node $CLIENT1 truncate $file 1
sleep 1
do_node $CLIENT1 touch $file
mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT || error "$CLIENT1 evicted"
+ client_up $CLIENT1 || error "$CLIENT1 evicted"
if (($mtime_pre >= $mtime_post)); then
error "time not changed: pre $mtime_pre, post $mtime_post"
fi
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0r "setattr of times and size does not check versions"
+run_test 0r "VBR: setattr of times and size does not check versions"
test_0s() {
local pre
error "version of source not changed: pre $pre, post $post"
fi
if (($tp_pre == $tp_post)); then
- error "version of target parent not changed: pre $tp_pre, post $tp_post"
+ [ -n "$mds20" ] || \
+ error "version of target parent not changed: pre $tp_pre, post $tp_post"
fi
}
-run_test 0s "link changes versions of source and target parent"
+run_test 0s "VBR: link changes versions of source and target parent"
test_0t() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mcreate $DIR/$tfile
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
error "link should fail"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0t "link checks version of target parent"
+run_test 0t "VBR: link checks version of target parent"
test_0u() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
do_node $CLIENT1 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 666 $DIR/$tfile
do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
error "link should fail"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0u "link checks version of source"
+run_test 0u "VBR: link checks version of source"
test_0v() {
local sp_pre
sp_post=$(get_version $CLIENT1 $DIR)
tp_post=$(get_version $CLIENT1 $DIR/$tdir)
if (($sp_pre == $sp_post)); then
- error "version of source parent not changed: pre $sp_pre, post $sp_post"
+ [ -n "$mds20" ] || \
+ error "version of source parent not changed: pre $sp_pre, post $sp_post"
fi
if (($tp_pre == $tp_post)); then
- error "version of target parent not changed: pre $tp_pre, post $tp_post"
+ [ -n "$mds20" ] || \
+ error "version of target parent not changed: pre $tp_pre, post $tp_post"
fi
}
-run_test 0v "rename changes versions of source parent and target parent"
+run_test 0v "VBR: rename changes versions of source parent and target parent"
test_0w() {
local pre
do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
post=$(get_version $CLIENT1 $DIR)
if (($pre == $post)); then
- error "version of parent not changed: pre $pre, post $post"
+ [ -n "$mds20" ] || \
+ error "version of parent not changed: pre $pre, post $post"
fi
}
-run_test 0w "rename within same dir changes version of parent"
+run_test 0w "VBR: rename within same dir changes version of parent"
test_0x() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mcreate $DIR/$tfile
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR
do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
error "rename should fail"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0x "rename checks version of source parent"
+run_test 0x "VBR: rename checks version of source parent"
test_0y() {
- local var=${SINGLEMDS}_svc
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
do_node $CLIENT1 mcreate $DIR/$tfile
do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 chmod 777 $DIR/$tdir
do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
zconf_umount $CLIENT2 $MOUNT
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1 not evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
error "rename should fail"
fi
zconf_mount $CLIENT2 $MOUNT
}
-run_test 0y "rename checks version of target parent"
+run_test 0y "VBR: rename checks version of target parent"
[ "$CLIENTS" ] && zconf_umount_clients $CLIENTS $DIR
-test_1a() {
+test_1() {
echo "mount client $CLIENT1,$CLIENT2..."
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
do_node $CLIENT2 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 1
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
zconf_umount $CLIENT2 $DIR
- facet_failover $SINGLEMDS
+ facet_failover mds
# recovery shouldn't fail due to missing client 2
- do_node $CLIENT1 df $DIR || return 1
+ client_up $CLIENT1 || return 1
# All 50 files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
zconf_umount_clients $CLIENTS $DIR
return 0
}
-run_test 1a "client during replay doesn't affect another one"
+run_test 1 "VBR: client during replay doesn't affect another one"
+
+test_2a() { # was test_2
+ #ls -al $DIR/$tdir/$tfile
-test_2a() {
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
do_node $CLIENT2 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT2 mcreate $DIR/$tdir/$tfile
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
- #client1 read data from client2 which will be lost
+ #do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 1
do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
zconf_umount $CLIENT2 $DIR
- facet_failover $SINGLEMDS
+ facet_failover mds
# recovery shouldn't fail due to missing client 2
- do_node $CLIENT1 df $DIR || return 1
+ client_up $CLIENT1 || return 1
# All 50 files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
+
do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
zconf_mount $CLIENT2 $DIR || error "mount $CLIENT2 $DIR fail"
zconf_umount_clients $CLIENTS $DIR
return 0
}
-run_test 2a "lost data due to missed REMOTE client during replay"
+run_test 2a "VBR: lost data due to missed REMOTE client during replay"
#
# This test uses three Lustre clients on two hosts.
test_2b() {
local pre
local post
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0"
zconf_mount $CLIENT1 $MOUNT
zconf_mount $CLIENT2 $MOUNT2
zconf_mount $CLIENT2 $MOUNT1
# "U" Unable to replay.
# "J" Rejected.
#
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
do_node $CLIENT2 chown :$RUNAS_ID $DIR2/$tfile-a # U
do_node $CLIENT2 chown :$RUNAS_ID $DIR1/$tfile-b # R
do_node $CLIENT1 chown $RUNAS_ID $DIR/$tfile-b # R
zconf_umount $CLIENT2 $MOUNT2
- facet_failover $SINGLEMDS
+ facet_failover mds
- do_node $CLIENT1 df $MOUNT && error "$CLIENT1:$MOUNT not evicted"
- do_node $CLIENT2 df $MOUNT1 || error "$CLIENT2:$MOUNT1 evicted"
+ client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
+ client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
#
# Check the MDT epoch. $post must be the first transaction
zconf_umount $CLIENT2 $MOUNT1
zconf_umount $CLIENT1 $MOUNT
}
-run_test 2b "3 clients: some, none, and all reqs replayed"
+run_test 2b "VBR: 3 clients: some, none, and all reqs replayed"
test_3a() {
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
#make sure the time will change
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0" || return
+ do_facet mds "$LCTL set_param *.${mds_svc}.atime_diff=0" || return
do_node $CLIENT1 touch $DIR/$tfile
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile
sleep 1
- replay_barrier $SINGLEMDS
+ replay_barrier mds
#change time
do_node $CLIENT2 touch $DIR/$tfile
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile
#another change
do_node $CLIENT1 touch $DIR/$tfile
#remove file
- do_node $CLIENT1 rm $DIR/$tfile
+ do_node $CLIENT2 rm $DIR/$tfile
zconf_umount $CLIENT2 $DIR
- facet_failover $SINGLEMDS
+ facet_failover mds
# recovery shouldn't fail due to missing client 2
- do_node $CLIENT1 df $DIR || return 1
+ client_up $CLIENT1 || return 1
do_node $CLIENT1 $CHECKSTAT $DIR/$tfile && return 2
zconf_mount $CLIENT2 $DIR || error "mount $CLIENT2 $DIR fail"
return 0
}
-run_test 3a "setattr of time/size doesn't change version"
+run_test 3a "VBR: setattr of time/size doesn't change version"
test_3b() {
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
#make sure the time will change
- local var=${SINGLEMDS}_svc
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0" || return
-
+ do_facet mds "$LCTL set_param *.${mds_svc}.atime_diff=0" || return
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=0" || return
do_node $CLIENT1 touch $DIR/$tfile
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile
sleep 1
- replay_barrier $SINGLEMDS
+ replay_barrier mds
#change mode
do_node $CLIENT2 chmod +x $DIR/$tfile
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile
do_node $CLIENT1 chmod -x $DIR/$tfile
zconf_umount $CLIENT2 $DIR
- facet_failover $SINGLEMDS
+ facet_failover mds
# recovery should fail due to missing client 2
- do_node $CLIENT1 df $DIR && return 1
+ client_evicted $CLIENT1 || return 1
do_node $CLIENT1 $CHECKSTAT -p 0755 $DIR/$tfile && return 2
zconf_mount $CLIENT2 $DIR || error "mount $CLIENT2 $DIR fail"
return 0
}
-run_test 3b "setattr of permissions changes version"
+run_test 3b "VBR: setattr of permissions changes version"
+
+test_3c() {
+ [ "$FAILURE_MODE" = HARD ] || \
+ { skip "The HARD failure is needed" && return 0; }
+
+ [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID -- skipping" && return
+
+ zconf_mount_clients $CLIENT1 $DIR
+ zconf_mount_clients $CLIENT2 $DIR
+
+ # check that permission changes are synced
+ do_facet mds "$LCTL set_param *.${mds_svc}.sync_permission=1"
+
+ do_node $CLIENT1 mkdir -p $DIR/d3c/sub || error
+ #chown -R $RUNAS_ID $MOUNT1/d3
+ do_node $CLIENT1 ls -la $DIR/d3c
+
+ # only HARD failure will work as we use sync operation
+ replay_barrier mds
+ do_node $CLIENT2 mcreate $DIR/d3c/$tfile-2
+ #set permissions
+ do_node $CLIENT1 chmod 0700 $UID $DIR/d3c
+ #secret file
+ do_node $CLIENT1 mcreate $DIR/d3c/sub/$tfile
+ do_node $CLIENT1 echo "Top Secret" > $DIR/d3c/sub/$tfile
+ #check user can't access new file
+ do_node $CLIENT2 $RUNAS ls $DIR/d3c && return 3
+ do_node $CLIENT1 $RUNAS ls $DIR/d3c && return 4
+ do_node $CLIENT1 $RUNAS cat $DIR/d3c/sub/$tfile && return 5
+
+ zconf_umount $CLIENT2 $DIR
+
+ facet_failover mds
+ # recovery shouldn't fail due to missing client 2
+ client_up $CLIENT1 || return 1
+
+ zconf_mount $CLIENT2 $DIR || error "mount $CLIENT2 $DIR fail"
+ do_node $CLIENT1 $RUNAS cat $DIR/d3c/sub/$tfile && return 6
+ do_node $CLIENT2 $RUNAS cat $DIR/d3c/sub/$tfile && return 7
+ do_facet mds "$LCTL set_param mds.${mds_svc}.sync_permission=0"
+
+ return 0
+}
+run_test 3c "VBR: permission dependency failure"
vbr_deactivate_client() {
local client=$1
zconf_mount_clients $CLIENT2 $DIR
do_node $CLIENT2 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 25
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
# All 50 files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 4
+ client_up $CLIENT2 || return 4
# All 25 files from client2 should have been replayed
do_node $CLIENT2 unlinkmany $DIR/$tdir/$tfile-2- 25 || return 5
}
run_test 4a "fail MDS, delayed recovery"
-test_4b(){
+test_4b() {
delayed_recovery_enabled || { skip "No delayed recovery support"; return 0; }
remote_server $CLIENT2 || \
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 25
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
# create another set of files
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 2
+ client_up $CLIENT2 || return 2
# All files from should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 3
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -m $DIR/$tfile- 25
do_node $CLIENT2 createmany -m $DIR/$tdir/$tfile-2- 25
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
# create another set of files
do_node $CLIENT1 createmany -m $DIR/$tfile-3- 25
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 2
+ client_up $CLIENT2 || return 2
# All files from should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 3
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tfile-2- 1
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 1
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR && return 1
+ facet_failover mds
+ client_evicted $CLIENT1 || return 1
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 2
+ client_up $CLIENT2 || return 2
# First 25 files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 3
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tfile-2- 1
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
do_node $CLIENT1 $CHECKSTAT $DIR/$tfile-2-0 && error "$tfile-2-0 exists"
# create another set of files
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR && return 4
+ client_evicted $CLIENT2 || return 4
# file from client2 should fail
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile-2-0 && error "$tfile-2-0 exists"
zconf_mount_clients $CLIENT2 $DIR
do_node $CLIENT2 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 25
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
+ facet_failover mds
# replay only 5 requests
do_node $CLIENT2 "sysctl -w lustre.fail_val=5"
#define OBD_FAIL_PTLRPC_REPLAY 0x50e
do_node $CLIENT2 "sysctl -w lustre.fail_loc=0x2000050e"
- do_node $CLIENT2 df $DIR
+ client_up $CLIENT2
# vbr_activate_client $CLIENT2
# need way to know that client stops replays
sleep 5
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
# All files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
zconf_mount_clients $CLIENT2 $DIR
do_node $CLIENT2 mkdir -p $DIR/$tdir
- replay_barrier $SINGLEMDS
+ replay_barrier mds
do_node $CLIENT1 createmany -o $DIR/$tfile- 25
do_node $CLIENT2 createmany -o $DIR/$tdir/$tfile-2- 25
do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
+ facet_failover mds
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 4
+ client_up $CLIENT2 || return 4
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 1
+ facet_failover mds
+ client_up $CLIENT1 || return 1
# All files should have been replayed
do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
rmultiop_start $CLIENT2 $DIR/$tfile O_tSc || return 1
do_node $CLIENT2 rm -f $DIR/$tfile
- replay_barrier $SINGLEMDS
+ replay_barrier mds
rmultiop_stop $CLIENT2 || return 2
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 3
+ facet_failover mds
+ client_up $CLIENT1 || return 3
#client1 is back and will try to open orphan
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 4
+ client_up $CLIENT2 || return 4
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile && error "$tfile exists"
zconf_umount_clients $CLIENTS $DIR
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- rmultiop_start $CLIENT2 $DIR/$tfile O_tSc|| return 1
- replay_barrier $SINGLEMDS
+ rmultiop_start $CLIENT2 $DIR/$tfile O_tSc || return 1
+ replay_barrier mds
do_node $CLIENT1 rm -f $DIR/$tfile
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 2
+ facet_failover mds
+ client_up $CLIENT1 || return 2
#client1 is back and will try to open orphan
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 3
+ client_up $CLIENT2 || return 3
rmultiop_stop $CLIENT2 || return 1
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile && error "$tfile exists"
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- rmultiop_start $CLIENT2 $DIR/$tfile O_tSc|| return 1
- replay_barrier $SINGLEMDS
+ rmultiop_start $CLIENT2 $DIR/$tfile O_tSc || return 1
+ replay_barrier mds
do_node $CLIENT1 rm -f $DIR/$tfile
rmultiop_stop $CLIENT2 || return 2
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 3
+ facet_failover mds
+ client_up $CLIENT1 || return 3
#client1 is back and will try to open orphan
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 4
+ client_up $CLIENT2 || return 4
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile && error "$tfile exists"
zconf_umount_clients $CLIENTS $DIR
zconf_mount_clients $CLIENT1 $DIR
zconf_mount_clients $CLIENT2 $DIR
- rmultiop_start $CLIENT1 $DIR/$tfile O_tSc|| return 1
- rmultiop_start $CLIENT2 $DIR/$tfile O_tSc|| return 2
- replay_barrier $SINGLEMDS
+ rmultiop_start $CLIENT1 $DIR/$tfile O_tSc || return 1
+ rmultiop_start $CLIENT2 $DIR/$tfile O_tSc || return 2
+ replay_barrier mds
do_node $CLIENT1 rm -f $DIR/$tfile
rmultiop_stop $CLIENT2 || return 3
rmultiop_stop $CLIENT1 || return 4
vbr_deactivate_client $CLIENT2
- facet_failover $SINGLEMDS
- do_node $CLIENT1 df $DIR || return 6
+ facet_failover mds
+ client_up $CLIENT1 || return 6
#client1 is back and will try to open orphan
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 8
+ client_up $CLIENT2 || return 8
do_node $CLIENT2 $CHECKSTAT $DIR/$tfile && error "$tfile exists"
zconf_umount_clients $CLIENTS $DIR
do_node $CLIENT1 mcreate $DIR/$tfile
do_node $CLIENT1 mkdir $DIR/$tfile-2
- replay_barrier $SINGLEMDS
+ replay_barrier mds
# missed replay from client1 will lead to recovery by versions
do_node $CLIENT1 touch $DIR/$tfile-2/$tfile
do_node $CLIENT2 rm $DIR/$tfile || return 1
do_node $CLIENT2 touch $DIR/$tfile || return 2
zconf_umount $CLIENT1 $DIR
- facet_failover $SINGLEMDS
- do_node $CLIENT2 df $DIR || return 6
+ facet_failover mds
+ client_up $CLIENT2 || return 6
do_node $CLIENT2 rm $DIR/$tfile || error "$tfile doesn't exists"
zconf_umount_clients $CLIENTS $DIR
do_node $CLIENT1 touch $DIR/$tfile
do_node $CLIENT1 mkdir $DIR/$tfile-2
- replay_barrier $SINGLEMDS
+ replay_barrier mds
# missed replay from client1 will lead to recovery by versions
do_node $CLIENT1 touch $DIR/$tfile-2/$tfile
do_node $CLIENT2 rm -f $DIR/$tfile || return 1
do_node $CLIENT2 mcreate $DIR/$tfile || return 2
zconf_umount $CLIENT1 $DIR
- facet_failover $SINGLEMDS
- do_node $CLIENT2 df $DIR || return 6
+ facet_failover mds
+ client_up $CLIENT2 || return 6
do_node $CLIENT2 rm $DIR/$tfile || error "$tfile doesn't exists"
zconf_umount $CLIENT2 $DIR
do_node $CLIENT1 touch $DIR/$tfile
do_node $CLIENT1 mkdir $DIR/$tfile-2
- replay_barrier $SINGLEMDS
+ replay_barrier mds
# missed replay from client1 will lead to recovery by versions
do_node $CLIENT1 touch $DIR/$tfile-2/$tfile
do_node $CLIENT2 rm -f $DIR/$tfile || return 1
do_node $CLIENT2 mkdir $DIR/$tfile || return 2
zconf_umount $CLIENT1 $DIR
- facet_failover $SINGLEMDS
+ facet_failover mds
do_node $CLIENT2 df $DIR || return 6
do_node $CLIENT2 rmdir $DIR/$tfile || error "$tfile doesn't exists"
echo "Started load PID=`cat pid.$CLIENT`"
done
- replay_barrier $SINGLEMDS
+ replay_barrier mds
sleep 3 # give clients a time to do operations
vbr_deactivate_client $CLIENT2
- log "$TESTNAME fail $SINGLEMDS 1"
- fail $SINGLEMDS
+ log "$TESTNAME fail mds 1"
+ fail mds
# wait for client to reconnect to MDS
sleep $TIMEOUT
vbr_activate_client $CLIENT2
- do_node $CLIENT2 df $DIR || return 4
+ client_up $CLIENT2 || return 4
for CLIENT in ${CLIENTS//,/ }; do
PID=`cat pid.$CLIENT`
[ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
equals_msg `basename $0`: test complete, cleaning up
+#SLEEP=$((`date +%s` - $NOW))
+#[ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
check_and_cleanup_lustre
[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true