From 6350ade7a194a5f36f9204e78d1892e251dcb431 Mon Sep 17 00:00:00 2001 From: pjd Date: Sat, 19 Nov 2011 11:44:20 +0000 Subject: [PATCH] MFC r226613,r226615,r226616: r226613: libzpool task_alloc: pass only valid flags to kmem_alloc tqflags may contain other flags besided those that are suitable for kmem_alloc == umem_alloc Submitted by: avg r226615: thr_create: new_thread_ID may be NULL Submitted by: avg r226616: zdb: access dp_free_bpobj only if pool version is >= SPA_VERSION_DEADLISTS Submitted by: avg Approved by: re (kib) git-svn-id: svn://svn.freebsd.org/base/releng/9.0@227709 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- cddl/contrib/opensolaris/cmd/zdb/zdb.c | 6 ++++-- cddl/contrib/opensolaris/head/thread.h | 6 +++++- cddl/contrib/opensolaris/lib/libzpool/common/taskq.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c index c6e219df..bf710009 100644 --- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c +++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c @@ -2190,8 +2190,10 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); - (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, - count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { + (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, + count_block_cb, &zcb, NULL); + } if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; diff --git a/cddl/contrib/opensolaris/head/thread.h b/cddl/contrib/opensolaris/head/thread.h index 818f0781..d813a25d 100644 --- a/cddl/contrib/opensolaris/head/thread.h +++ b/cddl/contrib/opensolaris/head/thread.h @@ -76,6 +76,7 @@ static __inline int thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*), void *arg, long flags, thread_t *new_thread_ID) { + pthread_t dummy; int ret; assert(stack_base == NULL); @@ -85,9 +86,12 @@ thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*), pthread_attr_t attr; pthread_attr_init(&attr); - if(flags & THR_DETACHED) + if (flags & THR_DETACHED) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (new_thread_ID == NULL) + new_thread_ID = &dummy; + /* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */ ret = pthread_create(new_thread_ID, &attr, start_func, arg); diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c b/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c index 8db5d11c..c407bba0 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c +++ b/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c @@ -87,7 +87,7 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) { } mutex_exit(&tq->tq_lock); - t = kmem_alloc(sizeof (task_t), tqflags); + t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP); mutex_enter(&tq->tq_lock); if (t != NULL) -- 2.42.0