Open prp opened 4 years ago
@shaikshavali1 can you investigate this and add your finding here.
@prp here is the test run history of fallocate05 test. https://tfsproduks1.visualstudio.com/Ab5352d9a-5ed5-48f2-b767-7f273b55b53c/sgx-lkl/_TestManagement/Runs?runId=28158&resultId=100077&contributionId=ms.vss-test-web.test-result-history&_a=contribution
fallocate05 test was enabled 7 days ago with this PR https://github.com/lsds/sgx-lkl/pull/675
@prp
Summary: 1.tst_fill_fs() created 14 files in the error scenario. 2.cleanup() delete a fixed number of files i.e., 13 files. Hence, one file has still remained in the "mntpoint".
Analysis in detail: I tried to reproduce the issue locally but the issue is not reproduced. Observation: This test case invokes "tst_fill_fs" which creates 'n' number of files with random size to fill empty space on the filesystem. This function exit when there is no space on fs.
Link to "tst_fill_fs()": https://github.com/lsds/ltp/blob/933335b9dd6aa730d4803ef2456e6c8081aa57c7/lib/tst_fill_fs.c#L14
This 'n' number of files typically 13 files. which is removed in the cleanup function.
Link to "cleanup()": https://github.com/lsds/ltp/blob/933335b9dd6aa730d4803ef2456e6c8081aa57c7/testcases/kernel/syscalls/fallocate/fallocate05.c#L85
As per the logs shared in the issue description, the "tst_fill_fs" has created 14 files to fill the filesystem space. In PASS scenario "tst_fill_fs" creates 13 files to fill the space in the filesystem.
[[ SGX-LKL ]] libc_start_main_stage2(): Calling app main: /ltp/testcases/kernel/syscalls/fallocate/fallocate05
tst_test.c:1106: INFO: Timeout per run is 0h 05m 00s
tst_test.c:1125: INFO: No fork support
tst_fill_fs.c:29: INFO: Creating file mntpoint/file0 size 53121707
tst_fill_fs.c:29: INFO: Creating file mntpoint/file1 size 30471145
tst_fill_fs.c:29: INFO: Creating file mntpoint/file2 size 98150909
tst_fill_fs.c:29: INFO: Creating file mntpoint/file3 size 91247207
tst_fill_fs.c:29: INFO: Creating file mntpoint/file4 size 23437525
tst_fill_fs.c:29: INFO: Creating file mntpoint/file5 size 18763313
tst_fill_fs.c:29: INFO: Creating file mntpoint/file6 size 3276218
tst_fill_fs.c:29: INFO: Creating file mntpoint/file7 size 17595605
tst_fill_fs.c:29: INFO: Creating file mntpoint/file8 size 14301264
tst_fill_fs.c:29: INFO: Creating file mntpoint/file9 size 4444240
tst_fill_fs.c:29: INFO: Creating file mntpoint/file10 size 20896333
tst_fill_fs.c:29: INFO: Creating file mntpoint/file11 size 98294094
tst_fill_fs.c:29: INFO: Creating file mntpoint/file12 size 70551612
tst_fill_fs.c:49: INFO: write(): ENOSPC (28)
fallocate05.c:51: PASS: write() wrote 8192 bytes
fallocate05.c:60: PASS: fallocate() on full FS: ENOSPC (28)
fallocate05.c:69: PASS: fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)
fallocate05.c:75: PASS: write()
[[ SGX-LKL ]] lkl_terminate(): terminating LKL (exit_status=0)
[[ SGX-LKL ]] lkl_termination_thread(): termination thread unblocked
[[ SGX-LKL ]] lkl_termination_thread(): calling lkl_sys_chdir(/)
The cleanup() function removes only 13 files created by "tst_fill_fs" . It left one file in "mntpoint". Because of this reason SAFE_RMDIR of "mntpoint" is causing failure.
Link to problematic code: https://github.com/lsds/ltp/blob/933335b9dd6aa730d4803ef2456e6c8081aa57c7/testcases/kernel/syscalls/fallocate/fallocate05.c#L91
Error Logs (taken from the issue's description):
tst_fill_fs.c:47: [1;31mBROK: [0mwrite(): SUCCESS (0)
safe_macros.c:184: [1;35mWARN: [0mfallocate05.c:91: rmdir(mntpoint) failed: ENOTEMPTY (39)
(cc: @hukoyu)
The LTP test
kernel-syscalls-fallocate-fallocate05-(debug)-(run-hw)-(8-ethreads)
can show the following failure:I believe that this is a problem with the test. Looking at the code here, it doesn't seem that all the created files are deleted before the directory is removed.
(cc: @hukoyu)