Age | Commit message (Collapse) | Author |
|
I observes segfaults in integck test, and unfortunately I do not have the core
file to investigate the problem. But I see one possibility for the test to
segfault - it has unbounded recursion. Limit the maximum recursion depth.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
If we are not in power cut testing mode (-p was not used) and we get an
unexpected EROFS, we silently exit. This patch fixes this behavior and make
the test loudly fail instead.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test sometimes dies due to SIGBUS because a power cut event happens when
we are writing to an mmap()'ed area. SIGBUS is very difficult to ignore, so
fix the issue simply by avoiding doing 'mmap()' operations when in power cut
testing mode.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Similarly to the previous commit, do not verify operations when in
power-cut testing mode. Again, this is because write-back may fail
meanwhile.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
In 'check_failed()' use the file and line number provided by the CHECK()
macro via the function parameters, rather than using __LINE__ directly.
Otherwise the funtion prints its own line, instead of the line where the
CHECK() failed.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not check the file-system when we are in power cut mode. Currently
we still check the FS if we did not encounter any error, and the test
fails sometimes because meanwhile write-back encounters an error and
drops pages. Disable the checking so far. It should be enabled when
we implement the 'clean' flag for files.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Introduce a 'check_tested_fs()' helper function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not print extra messages when unable to re-mount - they are
already printed by the recover function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The integck test assumes that if the FS is rootfs then it cannot
re-mount it, otherwise it can. However, this is not true because the
tested FS can be not remountable even if it is not rootfs, e.g., if
'integck' lives on this FS and is executed from it.
This patch improves the integck logic and actually checks wheter it
is possible to re-mount the FS before starting the test.
Also, it makes sure that power cut testing is run only on re-mountable
FS, because we have to be able to clean the "corrupted" state of the
file-system.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Commit 08cfd9d7cacc3c0b97530ad7e13fa8db75e99947 introduced a bug:
we do not re-mount the FS before checking at the first iteration.
This patch fixes the issue.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
-v (verbose) switch is supposed to turn power cut testing error
messages on/off. However, it does not work because the messages
are printed even if -v was not specified. This patch fixes it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Instead of using rand_r with own seed for operations and rand() with
global state for data it is cleaner to use rand_r with own different
states for these things. This patch eliminates 'srand()' and 'rand()'
usage.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Currently integck uses the same global random generator for everything -
for choosing the operation, generating the data, and for checking. This
makes integck to become stuck sometimes. My guess this is because of
we somehow re-set it back with srand() when checking files.
This patch makes integck use different generators for data and for
choosing operations by using rand_r() with own seed for operations.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
I often need to use gdb to debug integck, or sometimes even attach
already running integck. But when it is compiled with optimizations, it
is nearly impossible to use gdb. Introduce 'debug' target to compile
integck without optimizations.
Additionally, to make the stack backtraces work, add a dirty hack to
integck.c to remove all the static keywords - this turns static
functions to non-static and makes them appear in stack backtraces.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When -e option is used verify file holes after the truncate
operation. Re-use the existing 'file_check_hole()' function for
this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When -e options is used - verify written data. Re-use the existing
file_check_data() function to implement this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Improve the test and add -e option which forces integck to verify all
operation it performs. This patch does not implement file writes and
holes operations so far - will be done in subsequent patches.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch teaches the 'CHECK()' macro to print the back-trace in
case of failure which is sometimes very useful for debugging. This
patch also adds a helper function for the 'CHECK()' macro because
otherwise it becomes too large.
Note, since all functions in the test are static, the stack trace
does not really show symbols.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The integck test does not depend on the "common" directory any more,
so we do not have to have -I ../lib for compilation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Fix typos, make it a bit more descriptive.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This is a dirty patch - it makes many changes, but I simply had no
time to split it. And because this test is something no one except me
and Adrian cares about, I do not want to spend too much time creating
nice patches. Anyway, this patch make the power cut testing mode work.
Now you can run the test like "./integck /mnt/ubifs -p" and it will
run recover from emulated power cut failures and continue forever,
untill an unexpected issue is met.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The 'errmsg()' macro adds "\n" at the end, so do not use it in our
'pcv()' and 'CHECK()' macros.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
If a power cut emulation error happens and we are trying to re-mount
the file-system, do not assume it is mounted because the failure could
have happened after it had had been unmounted but before it was
successfully mounted.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When re-mountig to recover from the emulated power-cut failure then we should
do a bit less fancy things, e.g., we should not try to re-mount to R/O and R/W
modes forth and back, but we should instead just unmount directly.
Additionally, we should not die if mount fails because there may be a power
cut emulation during mounting. Thus, create a separate function for recovering
and try to recover in a loop.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'add_dir_entry()' to allocate the file/dir/symlink object for
the client. This simplifies client's code. The only place where we
do not want to do this is when we are creating a hardling pointing
to an existing file.
Teach 'remove_dir_entry()' to free the file/dir/symlink object for
the client. Similarly, this simplifies client's code. The only place
where we do not want to do this is the rename function - when we
rename an object we want to only change its direntry, but not the
object itself.
But the main motivation for this change is not just to clean-up, but
to fix another memory leak. In the re-name function we free the
'rename_entry', but we did not free the corresponding object. This
patch fixes the situation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test forgets to free the args.mount_opts string on exit - fix this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
If the test runs in power-cut testing mode, do not exit in case of
EROFS error - but instead re-mount and start again.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Refuse to test the file-system if it is mounted Read-only.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We always pass non-NULL 'parent' argument to 'new_dir()', so no need to
test it for NULL.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch kills the "name" field from 'struct file_info' where we stored
the original file name. We do not really need to keep this name around,
becaus it might have long gone and it is not very interesting. Besides,
we have several memory leaks where we leak 'file->name' strings, so this
is the easiest way to fix those leaks as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We do not need to store directory name in the 'struct dir_info' objects,
because we already have it in 'struct dir_entry_info'. So we duplicate
the names for directories in 'dir->name' and 'dir->entry->name'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'add_dir_entry()' consistent and allocate name for all types,
not only for 'd' and 's'. Also, since 'add_dir_entry()' sets the
parent - do not do this in the calling functions.
This is a clean-up which makes 'add_dir_entry()' more consistent.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When we create a symlink we also allocate a symlink_info structure
and the target path name. But when we remove a symlink - we do not
delete that memory. This patch fixes the issue.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test leaks memory like hell because it does not free the raw writes
information. This patch fixes the leaks.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We have duplicated code for freeing write informatio - put it into
a helper function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not initialize dir->name because add_dir_entry already does
this for us, so we leak the memory.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When removing a directory and freeing corresponding 'dir_info' object -
do not forget to free directory name as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_truncate_file()' return an error to the caller if it fails
to open the file or to truncate it.
Additionally, check the error code from 'open()' in other places.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'file_open()' return an error to the caller if it fails to open
the file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'operate_on_entry()' handle handle errors from all functions
it calls and return the error code to the caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_unlink_file()' return an error to the caller if the
file cannot be unlinked.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'dir_remove()' to return an error to the caller if it fails to
remove the directory. Also, there was a memory leak - the 'path'
string was not freed - fix it as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When 'symlink_remove()' fails to unling a symlink - return an error to
the calling function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'rename_entry()' return an error to the caller when it fails
to rename a directory entry.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'operate_on_dir()' functions propogate errors up if any of
the functions it calls failed. This patch also makes 'operate_on_entry()'
return an error code, but without actual implementation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_new()' to return -1 if it fails to create a file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|