Whamcloud - gitweb
LU-2735 test: disable LRU to avoid page deletion
authorHongchao Zhang <hongchao.zhang@intel.com>
Tue, 5 Feb 2013 05:07:38 +0000 (13:07 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 14 Mar 2013 06:16:14 +0000 (02:16 -0400)
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 <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/5475
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd_support.h
lustre/obdclass/lu_object.c
lustre/tests/sanity.sh

index 6d3ccf8..c0419ba 100644 (file)
@@ -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
index 117f607..fd8c2d7 100644 (file)
@@ -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
index 41bcfc6..c190c7c 100644 (file)
@@ -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