overlay/060: Use falloc to make sure a meta copy file got copied up

Overlayfs might copy up data of file on first write of file (and
not necessarily upon open of file). So call falloc file opened
with O_RDWR and after that data must have been copied up.

[Eryu: add _require_xfs_io_command "falloc" to make sure underlying
fs have fallocate(2) support]

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Vivek Goyal
2019-02-04 13:34:54 -05:00
committed by Eryu Guan
parent 6d17c9076f
commit 3e3fa955fb
+2 -1
View File
@@ -36,6 +36,7 @@ _supported_os Linux
# them explicity after test.
_require_scratch_nocheck
_require_scratch_overlay_features index redirect_dir metacopy
_require_xfs_io_command "falloc"
# remove all files from previous tests
_scratch_mkfs
@@ -170,7 +171,7 @@ test_common()
# Trigger data copy up and check absence of metacopy xattr.
mount_overlay $_lowerdir
$XFS_IO_PROG -c "open -a $SCRATCH_MNT/$_target"
$XFS_IO_PROG -c "falloc 0 1" $SCRATCH_MNT/$_target >> $seqres.full
echo "check properties of data copied up file"
check_file_size_contents $SCRATCH_MNT/$_target $_size "$_data"
umount_overlay