2013-04-01 10:57:41 +00:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:42 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
|
|
|
|
|
#
|
2013-04-01 10:57:41 +00:00
|
|
|
# FS QA Test No. 307
|
|
|
|
|
#
|
|
|
|
|
# Check if ctime is updated and written to disk after setfacl
|
|
|
|
|
#
|
|
|
|
|
# Regression test for the following extN commits
|
|
|
|
|
# c6ac12a ext4: update ctime when changing the file's permission by setfacl
|
|
|
|
|
# 30e2bab ext3: update ctime when changing the file's permission by setfacl
|
|
|
|
|
# 523825b ext2: update ctime when changing the file's permission by setfacl
|
|
|
|
|
#
|
|
|
|
|
# Based on test 277
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
|
|
|
|
seqres=$RESULT_DIR/$seq
|
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
cd /
|
|
|
|
|
rm -f $testfile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
2018-01-30 13:54:58 +00:00
|
|
|
. ./common/attr
|
2013-04-01 10:57:41 +00:00
|
|
|
|
|
|
|
|
testfile=$SCRATCH_MNT/testfile.$seq
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs generic
|
|
|
|
|
_supported_os Linux
|
|
|
|
|
_require_scratch
|
2018-01-30 13:54:58 +00:00
|
|
|
_require_acls
|
2013-04-01 10:57:41 +00:00
|
|
|
|
|
|
|
|
echo "Silence is golden"
|
|
|
|
|
|
|
|
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
|
|
|
_scratch_mount >/dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
touch $testfile
|
2016-02-19 10:44:53 +11:00
|
|
|
_scratch_cycle_mount
|
2013-04-01 10:57:41 +00:00
|
|
|
ctime1=`stat -c %Z $testfile`
|
|
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
setfacl -m 'u::x,g::x,o::x' $testfile
|
|
|
|
|
ctime2=`stat -c %Z $testfile`
|
|
|
|
|
|
2016-02-19 10:44:53 +11:00
|
|
|
_scratch_cycle_mount
|
2013-04-01 10:57:41 +00:00
|
|
|
ctime3=`stat -c %Z $testfile`
|
|
|
|
|
|
|
|
|
|
if [ "$ctime1" == "$ctime2" ]; then
|
|
|
|
|
echo "error: ctime not updated after setfacl"
|
|
|
|
|
elif [ "$ctime1" == "$ctime3" ]; then
|
|
|
|
|
echo "error: on disk ctime not updated"
|
|
|
|
|
else
|
|
|
|
|
status=0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exit
|