2011-11-03 21:55:53 +04:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:53 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
|
#
|
2019-06-28 18:59:06 -04:00
|
|
|
# FSQA Test No. ext4/039
|
2011-11-03 21:55:53 +04:00
|
|
|
#
|
|
|
|
|
# Test data journaling flag switch for a single file
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2011-11-03 21:55:53 +04:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
2016-06-09 14:42:31 -04:00
|
|
|
# ext3 and ext4 don't support direct IO in journalling mode
|
2012-08-16 11:14:35 +02:00
|
|
|
write_opt_list="iflag=noatime conv=notrunc conv=fsync"
|
|
|
|
|
|
2011-11-03 21:55:53 +04:00
|
|
|
# get standard environment, filters and checks
|
2013-03-15 12:28:04 +00:00
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
2011-11-03 21:55:53 +04:00
|
|
|
_workout()
|
|
|
|
|
{
|
2012-08-16 11:14:35 +02:00
|
|
|
echo "Switch data journalling mode. Silence is golden."
|
2011-11-03 21:55:53 +04:00
|
|
|
chattr_opt_list="+j -j +jS -j"
|
|
|
|
|
idx=0
|
|
|
|
|
#
|
|
|
|
|
for write_opt in $write_opt_list
|
|
|
|
|
do
|
|
|
|
|
idx=$((idx + 1))
|
|
|
|
|
for chattr_opt in $chattr_opt_list
|
|
|
|
|
do
|
|
|
|
|
|
|
|
|
|
echo "OP write_opt: $write_opt 4M, \
|
2013-03-15 12:28:02 +00:00
|
|
|
chattr_opt: $chattr_opt" >>$seqres.full
|
2011-11-03 21:55:53 +04:00
|
|
|
dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
|
|
|
|
|
bs=1M count=4 $write_opt \
|
2013-03-15 12:28:02 +00:00
|
|
|
>> $seqres.full 2>&1 || exit
|
2016-04-05 11:46:12 +10:00
|
|
|
$CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx >> $seqres.full \
|
2011-11-03 21:55:53 +04:00
|
|
|
|| exit
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
sync
|
|
|
|
|
# Same as previous test, but for one file,
|
|
|
|
|
# and with ENOSPC triggering
|
|
|
|
|
for write_opt in $write_opt_list
|
|
|
|
|
do
|
|
|
|
|
idx=$((idx + 1))
|
|
|
|
|
for chattr_opt in $chattr_opt_list
|
|
|
|
|
do
|
|
|
|
|
|
|
|
|
|
echo "OP write_opt: $write_opt ENOSPC, \
|
2013-03-15 12:28:02 +00:00
|
|
|
chattr_opt: $chattr_opt" >>$seqres.full
|
2011-11-03 21:55:53 +04:00
|
|
|
dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
|
2013-03-15 12:28:02 +00:00
|
|
|
bs=1M $write_opt >> $seqres.full 2>&1
|
2016-04-05 11:46:12 +10:00
|
|
|
$CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx \
|
2013-03-15 12:28:02 +00:00
|
|
|
>> $seqres.full || exit
|
2011-11-03 21:55:53 +04:00
|
|
|
done
|
|
|
|
|
sync
|
|
|
|
|
unlink $SCRATCH_MNT/file.$idx
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs ext3 ext4
|
|
|
|
|
_supported_os Linux
|
2011-11-08 12:41:55 +04:00
|
|
|
_require_scratch
|
2018-01-17 16:23:50 -07:00
|
|
|
_exclude_scratch_mount_option dax
|
2011-11-03 21:55:53 +04:00
|
|
|
|
2015-08-04 14:10:49 +10:00
|
|
|
rm -f $seqres.full
|
2013-03-15 12:28:02 +00:00
|
|
|
_scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seqres.full 2>&1
|
2011-11-03 21:55:53 +04:00
|
|
|
_scratch_mount
|
|
|
|
|
|
|
|
|
|
if ! _workout; then
|
|
|
|
|
echo "workout failed"
|
|
|
|
|
_scratch_unmount
|
|
|
|
|
status=1
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if ! _scratch_unmount; then
|
|
|
|
|
echo "failed to umount"
|
|
|
|
|
status=1
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
echo "Check filesystem"
|
2014-08-13 11:01:04 +10:00
|
|
|
status=0
|
2011-11-03 21:55:53 +04:00
|
|
|
exit
|