Skip to contentSkip to conversation

Add test for misaligned fallocate()

PATCH Superseded Martin Doucha 3 participants 7 messages Feb 24, 2020 – Mar 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Make sure that space allocation and deallocation works (or fails) correctly even when the requested file range does not align with filesystem blocks.

Test on:
- empty file system
- full file system
- also test with and without copy-on-write when supported

---

I'd prefer to keep the if(blocksize < 2) sanity check. Over 90% of the validation checks we have in code will never trigger but we lose nothing by keeping them anyway. I'm actually more worried about fstat() bugs than any filesystem really using tiny blocksize.

Changes since v1:
- Fix compilation with --std=c89
- Misalign by@most 512 bytes, otherwise the test may miss an XFS bug on PPC

Changes since v2:
- Use tst_purge_dir() for cleanup between test iterations

Changes since v4:
- Code style fixes

 runtest/syscalls                              |   1 +
 .../kernel/syscalls/fallocate/fallocate06.c   | 257 ++++++++++++++++++
 2 files changed, 258 insertions(+)
 create mode 100644 testcases/kernel/syscalls/fallocate/fallocate06.c
runtest/syscalls +1 -0
index e42db9910..133102c4b 100644
@@ -186,6 +186,7 @@ fallocate02 fallocate02
 fallocate03 fallocate03
 fallocate04 fallocate04
 fallocate05 fallocate05
+fallocate06 fallocate06
 
 fsetxattr01 fsetxattr01
 fsetxattr02 fsetxattr02
testcases/kernel/syscalls/fallocate/fallocate06.c new file +257 -0

257 lines not on this page · raw message

Signature · 1 line
2.25.0
#1 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Hi!
Are the failures on xfs fixed by now?

Do we have a upstrem kernel commit we can add to the test as a tag?

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Quoted 5 lines · Cyril Hrubis

Hi!
Are the failures on xfs fixed by now?

Do we have a upstrem kernel commit we can add to the test as a tag?

Anthony Iliopoulos says in the BSC that the upstream fix is commit e093c4be760e ("xfs: Fix tail rounding in xfs_alloc_file_space()")

See https://bugzilla.suse.com/show_bug.cgi?id=1161087#c1

Signature · 7 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
#3 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Hi!

Quoted 7 lines
Quoted 4 lines

Are the failures on xfs fixed by now?

Do we have a upstrem kernel commit we can add to the test as a tag?

Anthony Iliopoulos says in the BSC that the upstream fix is commit e093c4be760e ("xfs: Fix tail rounding in xfs_alloc_file_space()")

I've added this as a tag and commend and also added a .gitignore entry and pushed. Thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Hi Cyril, Martin

When I test this case by using btrfs, this case failed as below:

fallocate06.c:174: CONF: File system does not support copy-on-write tst_test.c:1290: INFO: Testing on btrfs
tst_mkfs.c:90: INFO: Formatting /dev/loop0 with btrfs opts='' extra opts='' tst_test.c:1229: INFO: Timeout per run is 0h 05m 00s fallocate06.c:117: INFO: Copy-on-write is supported fallocate06.c:168: INFO: Case 1. Fill FS: no; Use copy on write: no fallocate06.c:157: PASS: write() successful
fallocate06.c:201: PASS: Misaligned allocation works as expected fallocate06.c:157: PASS: fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) successful
fallocate06.c:237: PASS: fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) cleared the correct file range fallocate06.c:168: INFO: Case 2. Fill FS: yes; Use copy on write: no tst_fill_fs.c:32: INFO: Creating file mntpoint/file0 size 21710183 tst_fill_fs.c:32: INFO: Creating file mntpoint/file1 size 8070086 tst_fill_fs.c:32: INFO: Creating file mntpoint/file2 size 3971177 tst_fill_fs.c:32: INFO: Creating file mntpoint/file3 size 36915315 tst_fill_fs.c:32: INFO: Creating file mntpoint/file4 size 70310993 tst_fill_fs.c:32: INFO: Creating file mntpoint/file5 size 4807935 tst_fill_fs.c:32: INFO: Creating file mntpoint/file6 size 90739786 tst_fill_fs.c:32: INFO: Creating file mntpoint/file7 size 76896492 tst_fill_fs.c:32: INFO: Creating file mntpoint/file8 size 72228649 tst_fill_fs.c:32: INFO: Creating file mntpoint/file9 size 36207821 tst_fill_fs.c:32: INFO: Creating file mntpoint/file10 size 81483962 tst_fill_fs.c:59: INFO: write(): ENOSPC (28)
fallocate06.c:157: PASS: write() successful
fallocate06.c:201: PASS: Misaligned allocation works as expected fallocate06.c:146: FAIL: fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) failed unexpectedly: ENOSPC (28)

It failed when we fill fs and not using cow. Is it a known issue(I see the previous eamils, but found nothing)?
I also used 5.6-rc3 kernel to test, it still failed.

Best Regards
Yang Xu

Quoted 12 lines

Hi!

Quoted 7 lines
Quoted 4 lines

Are the failures on xfs fixed by now?

Do we have a upstrem kernel commit we can add to the test as a tag?

Anthony Iliopoulos says in the BSC that the upstream fix is commit e093c4be760e ("xfs: Fix tail rounding in xfs_alloc_file_space()")

I've added this as a tag and commend and also added a .gitignore entry and pushed. Thanks.

#5 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Quoted 9 lines · Yang Xu

Hi Cyril, Martin

When I test this case by using btrfs, this case failed as below:

...

It failed when we fill fs and not using cow. Is it a known issue(I see the previous eamils, but found nothing)?
I also used 5.6-rc3 kernel to test, it still failed.

Yes, this is a known issue. Upstream kernel fix is currently being reviewed:
https://patchwork.kernel.org/patch/11357415/

Signature · 7 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
#6 lore raw

PATCH v5 1/1 Add test for misaligned fallocate()

Hi Martin

Quoted 5 lines · Yang Xu
Quoted 4 lines

Hi Cyril, Martin

When I test this case by using btrfs, this case failed as below:

Quoted 8 lines
Quoted 5 lines

...

It failed when we fill fs and not using cow. Is it a known issue(I see the previous eamils, but found nothing)?
I also used 5.6-rc3 kernel to test, it still failed.

Yes, this is a known issue. Upstream kernel fix is currently being reviewed:
https://patchwork.kernel.org/patch/11357415/

Thanks for a quick response.

Best Regards
Yang Xu

Quoted 1 line