2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Huawei. All Rights Reserved.
7 # Test access time update issue for directories in upper layer.
9 # Upstream Commit cd91304e7190 ("ovl: fix relatime for directories")
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
39 # remove all files from previous runs
42 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
43 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
44 mkdir -p $upperdir/test
46 _scratch_mount "-o relatime"
48 # access test dir, it's access time will be updated normally
51 pre_access_time=`stat -c "%X" $SCRATCH_MNT/test`
53 # In relatime mode, access time is only updated if the previous
54 # access time was earlier than the current modify or change time,
55 # so trigger modify and change time update.
56 touch $SCRATCH_MNT/test/foo
59 # access test dir again
60 ls $SCRATCH_MNT/test > /dev/null 2>&1
62 cur_access_time=`stat -c "%X" $SCRATCH_MNT/test`
64 # compare the results, current access time should later than the previous one
65 if [ $cur_access_time -le $pre_access_time ] ; then
66 echo "Access time is not updated correctly."
70 echo "Silence is golden"