From 879e8d045057941ae0a5117d096f53975ef12ad0 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 28 Feb 2012 14:15:35 -0700 Subject: [PATCH] LU-482 test: sync new fs before first replay test LVM lacks barrier support for kernel < 2.6.33, so we need to send an explicit sync and sleep to avoid the replay_barrier call in the first test being run from discarding blocks from just-formatted filesystems. Otherwise this incorrectly causes just-written metadata to be lost by the block layer by the dev-read-only failover test code. Signed-off-by: Andreas Dilger Change-Id: I69fc64298603ad75a4fcda09edde5bc7ded00c1e Reviewed-on: http://review.whamcloud.com/2223 Reviewed-by: Lai Siyao Reviewed-by: Niu Yawei Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/tests/replay-dual.sh | 5 ++++- lustre/tests/replay-single-lmv.sh | 6 +++++- lustre/tests/replay-single.sh | 6 +++++- lustre/tests/test-framework.sh | 7 +++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index 8359981..1af2e4d 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -38,7 +38,10 @@ rm -rf $DIR/[df][0-9]* [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE -sleep 10 # Avert LVM and VM inability to flush caches in pre .33 kernels +# LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels +if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then + sync; sleep 5; sync; sleep 5; sync; sleep 5 +fi test_0a() { touch $MOUNT2/$tfile-A # force sync FLD/SEQ update before barrier diff --git a/lustre/tests/replay-single-lmv.sh b/lustre/tests/replay-single-lmv.sh index c053978..3d8501f 100755 --- a/lustre/tests/replay-single-lmv.sh +++ b/lustre/tests/replay-single-lmv.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e #set -v @@ -39,6 +39,10 @@ fi mkdir -p $DIR +# LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels +if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then + sync; sleep 5; sync; sleep 5; sync; sleep 5 +fi test_0() { replay_barrier mds1 diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 676bc5e..da4b6f9 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -35,8 +35,12 @@ mkdir -p $DIR assert_DIR rm -rf $DIR/[df][0-9]* +# LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels +if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then + sync; sleep 5; sync; sleep 5; sync; sleep 5 +fi + test_0a() { # was test_0 - sleep 10 mkdir $DIR/$tfile replay_barrier $SINGLEMDS fail $SINGLEMDS diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index ad6ad36..495ccbd 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -256,6 +256,13 @@ init_test_env() { rm -f $TMP/*active } +kernel_version() { + echo -n $((($1 << 16) | ($2 << 8) | $3)) +} + +export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//") +export LINUX_VERSION_CODE=$(kernel_version ${LINUX_VERSION//\./ }) + case `uname -r` in 2.4.*) EXT=".o"; USE_QUOTA=no; [ ! "$CLIENTONLY" ] && FSTYPE=ext3;; *) EXT=".ko"; USE_QUOTA=yes;; -- 1.8.3.1