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
40 # remove all files from previous runs
43 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
44 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
45 mkdir -p $upperdir/test
47 _scratch_mount "-o relatime"
49 # access test dir, it's access time will be updated normally
52 pre_access_time=`stat -c "%X" $SCRATCH_MNT/test`
54 # In relatime mode, access time is only updated if the previous
55 # access time was earlier than the current modify or change time,
56 # so trigger modify and change time update.
57 touch $SCRATCH_MNT/test/foo
60 # access test dir again
61 ls $SCRATCH_MNT/test > /dev/null 2>&1
63 cur_access_time=`stat -c "%X" $SCRATCH_MNT/test`
65 # compare the results, current access time should later than the previous one
66 if [ $cur_access_time -le $pre_access_time ] ; then
67 echo "Access time is not updated correctly."
71 echo "Silence is golden"