The ztest_pattern_match() function is only called from an ASSERT
and needs only to be defined when debugging is enabled. This
change is to silence a gcc warning and belong with the other
gcc issues. I'm moving it to the gcc-unused topic branch.
The new spa_config_path string was lost from ztest_run_zdb() during
the onnv_141 merge. This commit puts it back in place so the '-f'
option is properly honored.
Additionally this function had been tweaked so ztest could be run
in-tree but that broke running it when installed as a package. I've
updated that chunk to detect where it's running and try to do the
right thing in both cases.
Closes#49
The upstream commit cb code had a few bugs:
1) The arguments of the list_move_tail() call in txg_dispatch_callbacks()
were reversed by mistake. This caused the commit callbacks to not be
called at all.
2) ztest had a bug in ztest_dmu_commit_callbacks() where "error" was not
initialized correctly. This seems to have caused the test to always take
the simulated error code path, which made ztest unable to detect whether
commit cbs were being called for transactions that successfuly complete.
3) ztest had another bug in ztest_dmu_commit_callbacks() where the commit
cb threshold was not being compared correctly.
4) The commit cb taskq was using 'max_ncpus * 2' as the maxalloc argument
of taskq_create(), which could have caused unnecessary delays in the txg
sync thread.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
A number of ztest functions create one or more 312B ztest_od_t data
structures. To conserve stack usage, this commit moves all of these data
structures to the heap. However, I am still seeing ztest segfaults due
to heavy stack usage of the dbuf_findbp() -> dbuf_hold_impl() recursion.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This check is part of ztest and a memory failure here is unlikely.
However, if this does occur simply exiting is an perfectly valid
way to handle the issue and it resulves the compiler warning.
ztest.c:5522: error: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
We were already modifing this function so it would run in the
local development environment, so let's just do the stack fixes
here are well. It's all simple enough.
While ztest does run in user space we run it with the same stack
restrictions it would have in kernel space. This ensures that any
stack related issues which would be hit in the kernel can be caught
and debugged in user space instead.
This patch is a first pass to limit the stack usage of every ztest
function to 1024 bytes. Subsequent updates can further reduce this
There are 3 fixes in thie commit. First, update ztest_run() to store
the thread id and not the address of the kthread_t. This will be freed
on thread exit and is not safe to use. This is pretty close to how
things were done in the original ztest code before I got there.
Second, for extra paranoia update thread_exit() to return a special
TS_MAGIC value via pthread_exit(). This value is then verified in
pthread_join() to ensure the thread exited cleanly. This can be
done cleanly because the kthread doesn't provide a return code
mechanism we need to worry about.
Third, replace the ztest deadman thread with a signal handler. We
cannot use the previous approach because the correct behavior for
pthreads is to wait for all threads to exit before terminating the
process. Since the deadman thread won't call exit by design we
end up hanging in kernel_exit(). To avoid this we just setup a
SIGALRM signal handle and register a deadman alarm. IMHO this
is simpler and cleaner anyway.
Move create/destroy function to correct places. I'm not sure why
this wasn't caught upstream it should have been, regardless let's
just fix it here.
Personally I find it handy to be able to enable full debugging in
zfs with the 'debug=' command line option so I'm enabled that as
well.
This is a portability change which removes the dependence of the Solaris
thread library. All locations where Solaris thread API was used before
have been replaced with equivilant Solaris kernel style thread calls.
In user space the kernel style threading API is implemented in term of
the portable pthreads library. This includes all threads, mutexs,
condition variables, reader/writer locks, and taskqs.