Whamcloud - gitweb
LU-482 test: sync new fs before first replay test
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 28 Feb 2012 21:15:35 +0000 (14:15 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 1 Mar 2012 17:31:38 +0000 (12:31 -0500)
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 <adilger@whamcloud.com>
Change-Id: I69fc64298603ad75a4fcda09edde5bc7ded00c1e
Reviewed-on: http://review.whamcloud.com/2223
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/replay-dual.sh
lustre/tests/replay-single-lmv.sh
lustre/tests/replay-single.sh
lustre/tests/test-framework.sh

index 8359981..1af2e4d 100755 (executable)
@@ -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
index c053978..3d8501f 100755 (executable)
@@ -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
index 676bc5e..da4b6f9 100755 (executable)
@@ -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
index ad6ad36..495ccbd 100644 (file)
@@ -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;;