Whamcloud - gitweb
LU-14286 osd-ldiskfs: fallocate() should zero new blocks 19/41119/10
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 31 Dec 2020 19:40:34 +0000 (01:10 +0530)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Jan 2021 01:10:00 +0000 (01:10 +0000)
commit72617588ac8cb2e3e5a7b8e5ebc201cab524d938
treeb210988b2de3a81ed13412bb7e3ec4ad73323845
parent088af126fdfee7d41974c7572c951c2bcb818719
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
Reviewed-on: https://review.whamcloud.com/41119
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osd-ldiskfs/osd_io.c
lustre/tests/fsx.c