LU-14286 osd-ldiskfs: fallocate() should zero new blocks
The ldiskfs osd_fallocate() does not correctly zero the
allocated blocks. This is not noticed during autotest and
local developer testing because the underlying storage is
zero-filled due to using a sparse backing file and will
usually read back as zero. Also, the fsx data correctness
test was not properly detecting fallocate() support, and
as a result this behavior was not detected properly.
'fsx' uses test_fallocate() to determine if fallocate()
along with its various FLAGS is enabled and could be
called. It was found that test_fallocate() always returned
false as a bug. Resulting is fallocate being skipped always
for all fsx runs.
This patches fixes test_fallocate() to properly determine
if fallocate calls could be supported or not and return
appropriately and correctly (1 or 0) true/false.
After patch:
~~~~~~~~~~~
$ MOUNT_2="yes" bash ./lustre/tests/llmount.sh
$ lfs setstripe -c -1 /mnt/lustre/f110
$ fsx -c 50 -p 100 -N 2500 -S 0 -l
10485760 /mnt/lustre*/f110
Chance of close/open is 1 in 50
Seed set to 4481
fd 0: /mnt/lustre/f110
fd 1: /mnt/lustre2/f110
fsx: test_fallocate: does not support fallocate mode 0x3, disabling!
fsx: test_fallocate: does not support fallocate mode 0x10, disabling!
skipping zero size read
:
fallocating to largest ever: 0x30ce
:
1900[0]
1609444486.316868 fallocate 0x7f6c thru 0xab3a (0x2bcf bytes)
:
2300[1]
1609444487.241910 fallocate 0x0697 thru 0xed8e (0xe6f8 bytes)
:
All operations completed A-OK!
$
Test-Parameters: trivial testlist=sanity,sanityn,sanity-dom env=COUNT=10000
Fixes:
48457868a02a ("LU-3606 fallocate: Implement fallocate preallocate operation")
Fixes:
853d180121a6 ("LU-3606 fsx: Add fallocate operation to fsx")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Idbb092db6bd09cfda129f6077dcbfae4f4c9d0d0