Remount client lustre if checkstat fails to make sure
the following tests running in a healthy environment
Change-Id: I764e83ee31d8cc19d79632e805a6e75225e67adf
Signed-off-by: sarah <sarah@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/4063
Tested-by: Hudson
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
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"
fi
}
run_test 1b "open (O_CREAT) checks version of parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
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"
fi
}
run_test 2b "create checks version of parent"
client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
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"
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
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"
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
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"
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
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"
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 "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
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
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"
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
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"
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
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"
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
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"
fi
}
run_test 6d "rename checks version of target parent"
+error_and_remount() {
+ error_noexit "$@"
+ remount_client $MOUNT
+ exit 1
+}
+
skip_env () {
$FAIL_ON_SKIP_ENV && error false $@ || skip $@
}
skip_env () {
$FAIL_ON_SKIP_ENV && error false $@ || skip $@
}