From e3d65eb4824e381d4160a9677477c348bb5f61e2 Mon Sep 17 00:00:00 2001
From: shadow <shadow>
Date: Thu, 19 Jul 2007 16:28:33 +0000
Subject: [PATCH] use do_facet instead of direct use sysctl for set fail_loc on
 OST

b=12858
i=green
i=adilger
---
 lustre/ChangeLog       |  6 ++++++
 lustre/tests/sanity.sh | 28 +++++++++++++++-------------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 7689310b62..25a5bf292c 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -528,6 +528,12 @@ Details    : To improve performance, disable most logging (for debug purposes)
 	     by default.  VFSTRACE, RPCTRACE, and DLMTRACE are now off by
 	     default, and HA includes fewer messages.
 
+Severity   : minor
+Bugzilla   : 12858
+Frequency  : only run on patchless client.
+Description: use do_facet on sanity.sh for test handling recoverables errors
+Details    : use do_facet instead of direct use sysctl for set fail_loc on OST
+
 --------------------------------------------------------------------------------
 
 2007-05-03  Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 36aef3683d..f688bea383 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -3880,10 +3880,10 @@ test_118b()
 	reset_async
 
 	#define OBD_FAIL_OST_ENOENT 0x217
-	sysctl -w lustre.fail_loc=0x217
+	do_facet ost sysctl -w lustre.fail_loc=0x217
 	multiop $DIR/$tfile Ow4096yc
 	RC=$?
-	sysctl -w lustre.fail_loc=0
+	do_facet ost sysctl -w lustre.fail_loc=0
         DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
         WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)
 
@@ -3913,7 +3913,7 @@ test_118c()
 	reset_async
 
 	#define OBD_FAIL_OST_EROFS               0x216
-	sysctl -w lustre.fail_loc=0x216
+	do_facet ost sysctl -w lustre.fail_loc=0x216
 
 	# multiop should block due to fsync until pages are written
 	multiop $DIR/$tfile Ow4096yc &
@@ -3929,7 +3929,7 @@ test_118c()
 		error "No page in writeback, writeback=$WRITEBACK"
 	fi
 
-	sysctl -w lustre.fail_loc=0
+	do_facet ost sysctl -w lustre.fail_loc=0
         wait $MULTIPID
 	RC=$?
 	if [[ $RC -ne 0 ]]; then
@@ -3953,7 +3953,7 @@ test_118d()
 	reset_async
 
 	#define OBD_FAIL_OST_BRW_PAUSE_BULK
-	sysctl -w lustre.fail_loc=0x214
+	do_facet ost sysctl -w lustre.fail_loc=0x214
 	# set 10s timeout
 	echo "10" > $LPROC/osc/resend_timeout
 	# multiop should block due to fsync until pages are written
@@ -3970,6 +3970,7 @@ test_118d()
 	fi
 
         wait $MULTIPID || error "Multiop fsync failed, rc=$?"
+	do_facet ost sysctl -w lustre.fail_loc=0
 
         DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
         WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)	
@@ -3992,11 +3993,12 @@ test_118f() {
 	# Should simulate EINVAL error which is fatal
         multiop $DIR/$tfile Owy
         RC=$?
-
 	if [[ $RC -eq 0 ]]; then
 		error "Must return error due to dropped pages, rc=$RC"
 	fi
-
+	
+        sysctl -w lustre.fail_loc=0x0
+        
         LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache)
         DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
         WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)
@@ -4054,14 +4056,14 @@ test_118h() {
         reset_async
 
 	#define OBD_FAIL_OST_BRW_WRITE_BULK      0x20e
-        sysctl -w lustre.fail_loc=0x20e
+        do_facet ost sysctl -w lustre.fail_loc=0x20e
 	# set 10s timeout
 	echo "10" > $LPROC/osc/resend_timeout
 	# Should simulate ENOMEM error which is recoverable and should be handled by timeout
         multiop $DIR/$tfile Owy
         RC=$?
 	
-        sysctl -w lustre.fail_loc=0
+        do_facet ost sysctl -w lustre.fail_loc=0
 	if [[ $RC -eq 0 ]]; then
 		error "Must return error due to dropped pages, rc=$RC"
 	fi
@@ -4089,7 +4091,7 @@ test_118i() {
         reset_async
 
 	#define OBD_FAIL_OST_BRW_WRITE_BULK      0x20e
-        sysctl -w lustre.fail_loc=0x20e
+        do_facet ost sysctl -w lustre.fail_loc=0x20e
 	
 	# set 10s timeout
 	echo "10" > $LPROC/osc/resend_timeout
@@ -4097,7 +4099,7 @@ test_118i() {
         multiop $DIR/$tfile Owy &
 	PID=$!
 	sleep 5
-	sysctl -w lustre.fail_loc=0
+	do_facet ost sysctl -w lustre.fail_loc=0
 	
 	wait $PID
         RC=$?
@@ -4128,12 +4130,12 @@ test_118j() {
         reset_async
 
 	#define OBD_FAIL_OST_BRW_WRITE_BULK2     0x220
-        sysctl -w lustre.fail_loc=0x220
+        do_facet ost sysctl -w lustre.fail_loc=0x220
 
 	# return -EIO from OST
         multiop $DIR/$tfile Owy
         RC=$?
-        sysctl -w lustre.fail_loc=0x0
+        do_facet ost sysctl -w lustre.fail_loc=0x0
 	if [[ $RC -eq 0 ]]; then
 		error "Must return error due to dropped pages, rc=$RC"
 	fi
-- 
GitLab