}
}
+# Report the block usage of root, $qa_user, and nobody
+_report_quota_blocks() {
+ repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}'
+}
+
+# Report the inode usage of root, $qa_user, and nobody
+_report_quota_inodes() {
+ repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}'
+}
+
# make sure this script returns success
/bin/true
_require_fiemap
_require_quota
_require_nobody
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
touch $testdir/urk
chown nobody $testdir/urk
touch $testdir/erk
-chown fsgqa $testdir/erk
-_repquota
+chown $qa_user $testdir/erk
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
echo "Change file ownership"
-chown fsgqa $testdir/file1
-chown fsgqa $testdir/file2
-chown fsgqa $testdir/file3
-_repquota
+chown $qa_user $testdir/file1
+chown $qa_user $testdir/file2
+chown $qa_user $testdir/file3
+_report_quota_blocks $SCRATCH_MNT
echo "CoW one of the files"
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Remount the FS to see if accounting changes"
_scratch_cycle_mount
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Chown one of the files"
chown nobody $testdir/file3
-_repquota
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 305
Format and mount
Create the original files
-root -- 3072 0 0 7 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 0 0 0 1 0 0
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
Change file ownership
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
CoW one of the files
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Remount the FS to see if accounting changes
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Chown one of the files
-root -- 0 0 0 4 0 0
-nobody -- 1024 0 0 2 0 0
-fsgqa -- 2048 0 0 3 0 0
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
_require_quota
_require_nobody
_require_odirect
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
touch $testdir/urk
chown nobody $testdir/urk
touch $testdir/erk
-chown fsgqa $testdir/erk
-_repquota
+chown $qa_user $testdir/erk
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
echo "Change file ownership"
-chown fsgqa $testdir/file1
-chown fsgqa $testdir/file2
-chown fsgqa $testdir/file3
-_repquota
+chown $qa_user $testdir/file1
+chown $qa_user $testdir/file2
+chown $qa_user $testdir/file3
+_report_quota_blocks $SCRATCH_MNT
echo "CoW one of the files"
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Remount the FS to see if accounting changes"
_scratch_cycle_mount
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Chown one of the files"
chown nobody $testdir/file3
-_repquota
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 326
Format and mount
Create the original files
-root -- 3072 0 0 7 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 0 0 0 1 0 0
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
Change file ownership
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
CoW one of the files
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Remount the FS to see if accounting changes
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Chown one of the files
-root -- 0 0 0 4 0 0
-nobody -- 1024 0 0 2 0 0
-fsgqa -- 2048 0 0 3 0 0
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
_require_fiemap
_require_quota
_require_nobody
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
sz=1048576
echo "Create the original files"
$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
echo "Set hard quota to prevent third reflink"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
-_repquota
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
+_report_quota_blocks $SCRATCH_MNT
echo "Try to reflink again"
touch $testdir/file3
-chown fsgqa $testdir/file3
-_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch
-_repquota
+chown $qa_user $testdir/file3
+su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 327
Format and mount
Create the original files
-root -- 0 0 0 4 0 0
-fsgqa -- 2048 0 0 2 0 0
+root 0 0 0
+fsgqa 2048 0 0
Set hard quota to prevent third reflink
-root -- 0 0 0 4 0 0
-fsgqa +- 2048 0 1024 2 0 0
+root 0 0 0
+fsgqa 2048 0 1024
Try to reflink again
cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded
-root -- 0 0 0 4 0 0
-fsgqa +- 2048 0 1024 3 0 0
+root 0 0 0
+fsgqa 2048 0 1024
_require_quota
_require_nobody
_require_odirect
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
sz=1048576
echo "Create the original files"
$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
echo "Set hard quota to prevent rewrite"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
-_repquota
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
+_report_quota_blocks $SCRATCH_MNT
echo "Try to dio write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 -d 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
_filter_xfs_io_error
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Try to write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
_filter_xfs_io_error
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Set hard quota to allow rewrite"
-setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT
-_repquota
+setquota -u $qa_user 0 8192 0 0 $SCRATCH_MNT
+_report_quota_blocks $SCRATCH_MNT
echo "Try to dio write the whole file"
_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
sync
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Try to write the whole file"
_pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full
sync
-_repquota
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 328
Format and mount
Create the original files
-root -- 0 0 0 4 0 0
-fsgqa -- 3072 0 0 3 0 0
+root 0 0 0
+fsgqa 3072 0 0
Set hard quota to prevent rewrite
-root -- 0 0 0 4 0 0
-fsgqa +- 3072 0 1024 3 0 0
+root 0 0 0
+fsgqa 3072 0 1024
Try to dio write the whole file
pwrite: Disk quota exceeded
-root -- 0 0 0 4 0 0
-fsgqa +- 3072 0 1024 3 0 0
+root 0 0 0
+fsgqa 3072 0 1024
Try to write the whole file
pwrite: Disk quota exceeded
-root -- 0 0 0 4 0 0
-fsgqa +- 3072 0 1024 3 0 0
+root 0 0 0
+fsgqa 3072 0 1024
Set hard quota to allow rewrite
-root -- 0 0 0 4 0 0
-fsgqa -- 3072 0 8192 3 0 0
+root 0 0 0
+fsgqa 3072 0 8192
Try to dio write the whole file
-root -- 0 0 0 4 0 0
-fsgqa -- 3072 0 8192 3 0 0
+root 0 0 0
+fsgqa 3072 0 8192
Try to write the whole file
-root -- 0 0 0 4 0 0
-fsgqa -- 3072 0 8192 3 0 0
+root 0 0 0
+fsgqa 3072 0 8192
_require_quota
_require_nobody
_require_xfs_io_command "cowextsize"
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
touch $testdir/urk
chown nobody $testdir/urk
touch $testdir/erk
-chown fsgqa $testdir/erk
-_repquota
+chown $qa_user $testdir/erk
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
echo "Change file ownership"
-chown fsgqa $testdir/file1
-chown fsgqa $testdir/file2
-chown fsgqa $testdir/file3
-_repquota
+chown $qa_user $testdir/file1
+chown $qa_user $testdir/file2
+chown $qa_user $testdir/file3
+_report_quota_blocks $SCRATCH_MNT
echo "CoW one of the files"
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Remount the FS to see if accounting changes"
_scratch_cycle_mount
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Chown one of the files"
chown nobody $testdir/file3
-_repquota
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 213
Format and mount
Create the original files
-root -- 3072 0 0 7 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 0 0 0 1 0 0
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
Change file ownership
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
CoW one of the files
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3520 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3520 0 0
Remount the FS to see if accounting changes
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Chown one of the files
-root -- 0 0 0 4 0 0
-nobody -- 1024 0 0 2 0 0
-fsgqa -- 2048 0 0 3 0 0
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
_require_nobody
_require_xfs_io_command "cowextsize"
_require_odirect
+_require_user
-_repquota() {
- repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
-}
rm -f $seqres.full
echo "Format and mount"
touch $testdir/urk
chown nobody $testdir/urk
touch $testdir/erk
-chown fsgqa $testdir/erk
-_repquota
+chown $qa_user $testdir/erk
+_report_quota_blocks $SCRATCH_MNT
_scratch_cycle_mount
echo "Change file ownership"
-chown fsgqa $testdir/file1
-chown fsgqa $testdir/file2
-chown fsgqa $testdir/file3
-_repquota
+chown $qa_user $testdir/file1
+chown $qa_user $testdir/file2
+chown $qa_user $testdir/file3
+_report_quota_blocks $SCRATCH_MNT
echo "CoW one of the files"
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Remount the FS to see if accounting changes"
_scratch_cycle_mount
-_repquota
+_report_quota_blocks $SCRATCH_MNT
echo "Chown one of the files"
chown nobody $testdir/file3
-_repquota
+_report_quota_blocks $SCRATCH_MNT
# success, all done
status=0
QA output created by 214
Format and mount
Create the original files
-root -- 3072 0 0 7 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 0 0 0 1 0 0
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
Change file ownership
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
CoW one of the files
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3520 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3520 0 0
Remount the FS to see if accounting changes
-root -- 0 0 0 4 0 0
-nobody -- 0 0 0 1 0 0
-fsgqa -- 3072 0 0 4 0 0
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
Chown one of the files
-root -- 0 0 0 4 0 0
-nobody -- 1024 0 0 2 0 0
-fsgqa -- 2048 0 0 3 0 0
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0