Whamcloud - gitweb
LU-2261 test: Re-enable sanity test 156 for zfs
[fs/lustre-release.git] / lustre / tests / sanity.sh
index f13bdd8..ab8b62d 100644 (file)
@@ -10160,142 +10160,141 @@ test_156() {
        local AFTER
        local file="$DIR/$tfile"
 
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-1956/LU-2261: stats unimplemented on OSD ZFS" &&
+       [ "$(facet_fstype ost1)" = "zfs" -a \
+          $(lustre_version_code ost1 -lt $(version_code 2.6.93)) ] &&
+               skip "LU-1956/LU-2261: stats not implemented on OSD ZFS" &&
                return
 
        roc_hit_init
 
-    log "Turn on read and write cache"
-    set_cache read on
-    set_cache writethrough on
-
-    log "Write data and read it back."
-    log "Read should be satisfied from the cache."
-    dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
-    BEFORE=`roc_hit`
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == CPAGES"; then
-        error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
-
-    log "Read again; it should be satisfied from the cache."
-    BEFORE=$AFTER
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == CPAGES"; then
-        error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Turn on read and write cache"
+       set_cache read on
+       set_cache writethrough on
 
+       log "Write data and read it back."
+       log "Read should be satisfied from the cache."
+       dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
+       BEFORE=$(roc_hit)
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    log "Turn off the read cache and turn on the write cache"
-    set_cache read off
-    set_cache writethrough on
+       log "Read again; it should be satisfied from the cache."
+       BEFORE=$AFTER
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    log "Read again; it should be satisfied from the cache."
-    BEFORE=`roc_hit`
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == CPAGES"; then
-        error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Turn off the read cache and turn on the write cache"
+       set_cache read off
+       set_cache writethrough on
 
-    log "Read again; it should not be satisfied from the cache."
-    BEFORE=$AFTER
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == 0"; then
-        error "IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Read again; it should be satisfied from the cache."
+       BEFORE=$(roc_hit)
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    log "Write data and read it back."
-    log "Read should be satisfied from the cache."
-    dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
-    BEFORE=`roc_hit`
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == CPAGES"; then
-        error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Read again; it should not be satisfied from the cache."
+       BEFORE=$AFTER
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == 0"; then
+               error "IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    log "Read again; it should not be satisfied from the cache."
-    BEFORE=$AFTER
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == 0"; then
-        error "IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Write data and read it back."
+       log "Read should be satisfied from the cache."
+       dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
+       BEFORE=$(roc_hit)
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
+       log "Read again; it should not be satisfied from the cache."
+       BEFORE=$AFTER
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == 0"; then
+               error "IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    log "Turn off read and write cache"
-    set_cache read off
-    set_cache writethrough off
+       log "Turn off read and write cache"
+       set_cache read off
+       set_cache writethrough off
 
-    log "Write data and read it back"
-    log "It should not be satisfied from the cache."
-    rm -f $file
-    dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
-    cancel_lru_locks osc
-    BEFORE=`roc_hit`
-    cat $file >/dev/null
-    AFTER=`roc_hit`
+       log "Write data and read it back"
+       log "It should not be satisfied from the cache."
+       rm -f $file
+       dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
+       cancel_lru_locks osc
+       BEFORE=$(roc_hit)
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
        if ! let "AFTER - BEFORE == 0"; then
                error_ignore bz20762 "IN CACHE: before: $BEFORE, after: $AFTER"
        else
                log "cache hits:: before: $BEFORE, after: $AFTER"
        fi
 
-    log "Turn on the read cache and turn off the write cache"
-    set_cache read on
-    set_cache writethrough off
+       log "Turn on the read cache and turn off the write cache"
+       set_cache read on
+       set_cache writethrough off
 
-    log "Write data and read it back"
-    log "It should not be satisfied from the cache."
-    rm -f $file
-    dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
-    BEFORE=`roc_hit`
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
+       log "Write data and read it back"
+       log "It should not be satisfied from the cache."
+       rm -f $file
+       dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
+       BEFORE=$(roc_hit)
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
        if ! let "AFTER - BEFORE == 0"; then
                error_ignore bz20762 "IN CACHE: before: $BEFORE, after: $AFTER"
        else
                log "cache hits:: before: $BEFORE, after: $AFTER"
        fi
 
-    log "Read again; it should be satisfied from the cache."
-    BEFORE=`roc_hit`
-    cancel_lru_locks osc
-    cat $file >/dev/null
-    AFTER=`roc_hit`
-    if ! let "AFTER - BEFORE == CPAGES"; then
-        error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-    else
-        log "cache hits:: before: $BEFORE, after: $AFTER"
-    fi
+       log "Read again; it should be satisfied from the cache."
+       BEFORE=$(roc_hit)
+       cancel_lru_locks osc
+       cat $file >/dev/null
+       AFTER=$(roc_hit)
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       else
+               log "cache hits:: before: $BEFORE, after: $AFTER"
+       fi
 
-    rm -f $file
+       rm -f $file
 }
-run_test 156 "Verification of tunables ============================"
+run_test 156 "Verification of tunables"
 
 #Changelogs
 err17935 () {