From e2a65adbb83ddad0d8a97dd1415ad30850216336 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Tue, 24 Jan 2017 20:13:49 +0300 Subject: OpenZFS 6871 - libzpool implementation of thread_create should enforce length is 0 Porting notes: - Several direct callers of zk_thread_create() are passing TS_RUN for the length. The `len` and `state` were inverted,this commit fixes them. Authored by: Eli Rosenthal Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Reviewed-by: Brian Behlendorf Ported-by: George Melikov mail@gmelikov.ru OpenZFS-issue: https://www.illumos.org/issues/6871 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/8fc9228 Closes #5621 --- cmd/raidz_test/raidz_test.c | 2 +- cmd/ztest/ztest.c | 4 ++-- include/sys/zfs_context.h | 2 +- lib/libzpool/kernel.c | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/raidz_test/raidz_test.c b/cmd/raidz_test/raidz_test.c index 55bfbf0ab..500ac3dae 100644 --- a/cmd/raidz_test/raidz_test.c +++ b/cmd/raidz_test/raidz_test.c @@ -704,7 +704,7 @@ run_sweep(void) VERIFY3P(zk_thread_create(NULL, 0, (thread_func_t)sweep_thread, - (void *) opts, TS_RUN, NULL, 0, 0, + (void *) opts, 0, NULL, TS_RUN, 0, PTHREAD_CREATE_JOINABLE), !=, NULL); } diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 139ff00cd..279e49fa3 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -6240,7 +6240,7 @@ ztest_run(ztest_shared_t *zs) * Create a thread to periodically resume suspended I/O. */ VERIFY3P((resume_thread = zk_thread_create(NULL, 0, - (thread_func_t)ztest_resume_thread, spa, TS_RUN, NULL, 0, 0, + (thread_func_t)ztest_resume_thread, spa, 0, NULL, TS_RUN, 0, PTHREAD_CREATE_JOINABLE)), !=, NULL); #if 0 @@ -6296,7 +6296,7 @@ ztest_run(ztest_shared_t *zs) VERIFY3P(thread = zk_thread_create(NULL, 0, (thread_func_t)ztest_thread, - (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0, + (void *)(uintptr_t)t, 0, NULL, TS_RUN, 0, PTHREAD_CREATE_JOINABLE), !=, NULL); tid[t] = thread->t_tid; } diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 6e950716c..bca89e1c9 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -262,7 +262,7 @@ typedef struct kthread { extern kthread_t *zk_thread_current(void); extern void zk_thread_exit(void); extern kthread_t *zk_thread_create(caddr_t stk, size_t stksize, - thread_func_t func, void *arg, size_t len, + thread_func_t func, void *arg, uint64_t len, proc_t *pp, int state, pri_t pri, int detachstate); extern void zk_thread_join(kt_did_t tid); diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index b0418cb09..40b96daba 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -147,13 +147,14 @@ zk_thread_helper(void *arg) kthread_t * zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg, - size_t len, proc_t *pp, int state, pri_t pri, int detachstate) + uint64_t len, proc_t *pp, int state, pri_t pri, int detachstate) { kthread_t *kt; pthread_attr_t attr; char *stkstr; ASSERT0(state & ~TS_RUN); + ASSERT0(len); kt = umem_zalloc(sizeof (kthread_t), UMEM_NOFAIL); kt->t_func = func; -- cgit v1.2.3