From: Vladimir Saveliev Date: Thu, 2 Sep 2010 11:36:13 +0000 (+0400) Subject: b=23291 directory atime update test X-Git-Tag: 2.0.52.0~8 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=afb5b03f1af87f98287bf54a2301a97cb8b65a31;p=fs%2Flustre-release.git b=23291 directory atime update test set atime to future set atime to now test atime_diff i=grev --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 03f0b90..d4c38d3 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2349,6 +2349,56 @@ test_39k() { } run_test 39k "write, utime, close, stat ========================" +# this should be set to future +TEST_39_ATIME=`date -d "1 year" +%s` + +test_39l() { + local atime_diff=$(do_facet $SINGLEMDS lctl get_param -n mdd.*.atime_diff) + + mkdir -p $DIR/$tdir + + # test setting directory atime to future + touch -a -d @$TEST_39_ATIME $DIR/$tdir + local atime=$(stat -c %X $DIR/$tdir) + [ "$atime" = $TEST_39_ATIME ] || \ + error "atime is not set to future: $atime, should be $TEST_39_ATIME" + + # test setting directory atime from future to now + local d1=$(date +%s) + ls $DIR/$tdir + local d2=$(date +%s) + + cancel_lru_locks mdc + atime=$(stat -c %X $DIR/$tdir) + [ "$atime" -ge "$d1" -a "$atime" -le "$d2" ] || \ + error "atime is not updated from future: $atime, should be $d1 dir atime + atime_diff + d1=$(date +%s) + ls $DIR/$tdir + d2=$(date +%s) + cancel_lru_locks mdc + atime=$(stat -c %X $DIR/$tdir) + [ "$atime" -ge "$d1" -a "$atime" -le "$d2" ] || \ + error "atime is not updated : $atime, should be $d2" + + do_facet $SINGLEMDS lctl set_param -n mdd.*.atime_diff=60 + sleep 3 + + # test not setting directory atime when now < dir atime + atime_diff + ls $DIR/$tdir + cancel_lru_locks mdc + atime=$(stat -c %X $DIR/$tdir) + [ "$atime" -ge "$d1" -a "$atime" -le "$d2" ] || \ + error "atime is updated to $atime, should remain $d1