From 020e353a21add0181af4a78302d2cd2e12bdf82d Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Tue, 5 Feb 2013 13:07:38 +0800 Subject: [PATCH] LU-2735 test: disable LRU to avoid page deletion In sanity.sh, subtest 151 checks whether the page written previously is in cache or not, this patch disable the LRU of objects in OST to avoid the object and its content(pages) to be dropped. Change-Id: Ie481d13215dac599e0b7e122fcc7e9819a053af5 Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/5475 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/include/obd_support.h | 1 + lustre/obdclass/lu_object.c | 3 +++ lustre/tests/sanity.sh | 32 +++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 6d3ccf8..c0419ba 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -394,6 +394,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_OBD_LOG_CANCEL_REP 0x606 #define OBD_FAIL_OBD_IDX_READ_NET 0x607 #define OBD_FAIL_OBD_IDX_READ_BREAK 0x608 +#define OBD_FAIL_OBD_NO_LRU 0x609 #define OBD_FAIL_TGT_REPLY_NET 0x700 #define OBD_FAIL_TGT_CONN_RACE 0x701 diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 117f607..fd8c2d7 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -317,6 +317,9 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) int bnr; int i; + if (OBD_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU)) + RETURN(0); + CFS_INIT_LIST_HEAD(&dispose); /* * Under LRU list lock, scan LRU list and move unreferenced objects to diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 41bcfc6..c190c7c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8456,15 +8456,29 @@ test_151() { set_osd_param $list '' writethrough_cache_enable 1 - # pages should be in the case right after write - dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || error "dd failed" - local BEFORE=`roc_hit` - cancel_lru_locks osc - cat $DIR/$tfile >/dev/null - local AFTER=`roc_hit` - if ! let "AFTER - BEFORE == CPAGES"; then - error "NOT IN CACHE: before: $BEFORE, after: $AFTER" - fi + # check write cache is enabled on all obdfilters + if get_osd_param $list '' writethrough_cache_enable | grep 0; then + echo "oss write cache is NOT enabled" + return 0 + fi + +#define OBD_FAIL_OBD_NO_LRU 0x609 + do_nodes $list $LCTL set_param fail_loc=0x609 + + # pages should be in the case right after write + dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || + error "dd failed" + + local BEFORE=`roc_hit` + cancel_lru_locks osc + cat $DIR/$tfile >/dev/null + local AFTER=`roc_hit` + + do_nodes $list $LCTL set_param fail_loc=0 + + if ! let "AFTER - BEFORE == CPAGES"; then + error "NOT IN CACHE: before: $BEFORE, after: $AFTER" + fi # the following read invalidates the cache cancel_lru_locks osc -- 1.8.3.1