{"action":"created","comment":{"url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/comments/132599211","pull_request_review_id":55698442,"id":132599211,"diff_hunk":"@@ -6419,28 +6414,19 @@ ztest_run(ztest_shared_t *zs)\n \t * Kick off all the tests that run in parallel.\n \t */\n \tfor (t = 0; t < ztest_opts.zo_threads; t++) {\n-\t\tkthread_t *thread;\n-\n-\t\tif (t < ztest_opts.zo_datasets &&\n-\t\t    ztest_dataset_open(t) != 0) {\n-\t\t\tumem_free(tid,\n-\t\t\t    ztest_opts.zo_threads * sizeof (kt_did_t));\n+\t\tif (t < ztest_opts.zo_datasets && ztest_dataset_open(t) != 0)\n \t\t\treturn;\n-\t\t}\n \n-\t\tVERIFY3P(thread = zk_thread_create(NULL, 0,\n-\t\t    (thread_func_t)ztest_thread,\n-\t\t    (void *)(uintptr_t)t, 0, NULL, TS_RUN, 0,\n-\t\t    PTHREAD_CREATE_JOINABLE), !=, NULL);\n-\t\ttid[t] = thread->t_tid;\n+\t\trun_threads[t] = thread_create(NULL, 0, ztest_thread,\n+\t\t    (void *)(uintptr_t)t, 0, NULL, TS_RUN, defclsyspri);\n \t}\n \n \t/*\n \t * Wait for all of the tests to complete.  We go in reverse order\n \t * so we don't close datasets while threads are still using them.\n \t */\n \tfor (t = ztest_opts.zo_threads - 1; t >= 0; t--) {\n-\t\tthread_join(tid[t]);\n+\t\tVERIFY0(pthread_join((pthread_t)run_threads[t], NULL));","path":"cmd/ztest/ztest.c","position":125,"original_position":125,"commit_id":"6104302b48924e84fab729784e64c389deddf2ec","original_commit_id":"6104302b48924e84fab729784e64c389deddf2ec","user":{"login":"tuxoko","id":119672,"avatar_url":"https://avatars3.githubusercontent.com/u/119672?v=4","gravatar_id":"","url":"https://api.github.com/users/tuxoko","html_url":"https://github.com/tuxoko","followers_url":"https://api.github.com/users/tuxoko/followers","following_url":"https://api.github.com/users/tuxoko/following{/other_user}","gists_url":"https://api.github.com/users/tuxoko/gists{/gist_id}","starred_url":"https://api.github.com/users/tuxoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuxoko/subscriptions","organizations_url":"https://api.github.com/users/tuxoko/orgs","repos_url":"https://api.github.com/users/tuxoko/repos","events_url":"https://api.github.com/users/tuxoko/events{/privacy}","received_events_url":"https://api.github.com/users/tuxoko/received_events","type":"User","site_admin":false},"body":"Yes, you're right. Sorry I didn't notice your changed the default for zk_thread_create because the diff was hidden...\r\n\r\nBut then there's another problem, do we always call pthread_join for every pthread_create? Wouldn't there be zombie threads if we don't do that?","created_at":"2017-08-11T00:17:59Z","updated_at":"2017-08-11T00:17:59Z","html_url":"https://github.com/zfsonlinux/zfs/pull/6495#discussion_r132599211","pull_request_url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495","_links":{"self":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/comments/132599211"},"html":{"href":"https://github.com/zfsonlinux/zfs/pull/6495#discussion_r132599211"},"pull_request":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495"}}},"pull_request":{"url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495","id":135243620,"html_url":"https://github.com/zfsonlinux/zfs/pull/6495","diff_url":"https://github.com/zfsonlinux/zfs/pull/6495.diff","patch_url":"https://github.com/zfsonlinux/zfs/pull/6495.patch","issue_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/6495","number":6495,"state":"open","locked":false,"title":"Simplify threads, mutexs, cvs and rwlocks","user":{"login":"behlendorf","id":148917,"avatar_url":"https://avatars2.githubusercontent.com/u/148917?v=4","gravatar_id":"","url":"https://api.github.com/users/behlendorf","html_url":"https://github.com/behlendorf","followers_url":"https://api.github.com/users/behlendorf/followers","following_url":"https://api.github.com/users/behlendorf/following{/other_user}","gists_url":"https://api.github.com/users/behlendorf/gists{/gist_id}","starred_url":"https://api.github.com/users/behlendorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behlendorf/subscriptions","organizations_url":"https://api.github.com/users/behlendorf/orgs","repos_url":"https://api.github.com/users/behlendorf/repos","events_url":"https://api.github.com/users/behlendorf/events{/privacy}","received_events_url":"https://api.github.com/users/behlendorf/received_events","type":"User","site_admin":false},"body":"### Description\r\n\r\n* Update the zk_thread_create() function to use the same trick\r\n  as Illumos.  Specifically, cast the new pthread_t to a void\r\n  pointer and return that as the kthread_t *.  This avoids the\r\n  issues assoicated with managing a wrapper structure and is\r\n  safe as long as the callers never attempt to dereference it.\r\n\r\n* Update all function prototypes passed to pthread_create() to\r\n  match the expected prototype.  We were getting away this with\r\n  before since the function were explicitly cast.\r\n\r\n* Replaced direct zk_thread_create() calls with thread_create()\r\n  for code consistency.  All consumers of libzpool now use the\r\n  proper wrappers with one exception.  In ztest there are two\r\n  callers of pthread_join() to handle wait for the run threads.\r\n  The situation is the same for Illumos.\r\n\r\n* The mutex_held() calls were converted to MUTEX_HELD().\r\n\r\n* Removed all mutex_owner() calls and retired the interface.\r\n  Instead use MUTEX_HELD() which provides the same information\r\n  and allows the implemenation details to be hidden.  In this\r\n  case the use of the pthread_equals() function.\r\n\r\n* The kthread_t, kmutex_t, krwlock_t, and krwlock_t types had\r\n  any non essential fields removed.  In the case of kthread_t\r\n  and kcondvar_t they could be directly typedef'd to pthread_t\r\n  and pthread_cond_t respectively.\r\n\r\n* Removed all extra ASSERTS from the thread, mutex, rwlock, and\r\n  cv wrapper functions.  In practice, pthreads already provides\r\n  the vast majority of checks as long as we check the return\r\n  code.  Removing this code from our wrappers help readability.\r\n\r\n### Motivation and Context\r\n\r\nIssue #6377\r\n\r\n### How Has This Been Tested?\r\n\r\nLocally with ztest.\r\n\r\n### Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [x] Bug fix (non-breaking change which fixes an issue)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Performance enhancement (non-breaking change which improves efficiency)\r\n- [x] Code cleanup (non-breaking change which makes code smaller or more readable)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n- [ ] Documentation (a change to man pages or other documentation)\r\n\r\n### Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the ZFS on Linux code style requirements.\r\n- [ ] I have updated the documentation accordingly.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [ ] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.\r\n- [x] All commit messages are properly formatted and contain `Signed-off-by`.\r\n- [ ] Change has been approved by a ZFS on Linux member.","created_at":"2017-08-10T23:30:40Z","updated_at":"2017-08-11T00:17:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"57e7752b4700c1d2e557937a9c1282e87c5d6b23","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495/commits","review_comments_url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495/comments","review_comment_url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/6495/comments","statuses_url":"https://api.github.com/repos/zfsonlinux/zfs/statuses/6104302b48924e84fab729784e64c389deddf2ec","head":{"label":"behlendorf:issue-6377","ref":"issue-6377","sha":"6104302b48924e84fab729784e64c389deddf2ec","user":{"login":"behlendorf","id":148917,"avatar_url":"https://avatars2.githubusercontent.com/u/148917?v=4","gravatar_id":"","url":"https://api.github.com/users/behlendorf","html_url":"https://github.com/behlendorf","followers_url":"https://api.github.com/users/behlendorf/followers","following_url":"https://api.github.com/users/behlendorf/following{/other_user}","gists_url":"https://api.github.com/users/behlendorf/gists{/gist_id}","starred_url":"https://api.github.com/users/behlendorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behlendorf/subscriptions","organizations_url":"https://api.github.com/users/behlendorf/orgs","repos_url":"https://api.github.com/users/behlendorf/repos","events_url":"https://api.github.com/users/behlendorf/events{/privacy}","received_events_url":"https://api.github.com/users/behlendorf/received_events","type":"User","site_admin":false},"repo":{"id":2003466,"name":"zfs","full_name":"behlendorf/zfs","owner":{"login":"behlendorf","id":148917,"avatar_url":"https://avatars2.githubusercontent.com/u/148917?v=4","gravatar_id":"","url":"https://api.github.com/users/behlendorf","html_url":"https://github.com/behlendorf","followers_url":"https://api.github.com/users/behlendorf/followers","following_url":"https://api.github.com/users/behlendorf/following{/other_user}","gists_url":"https://api.github.com/users/behlendorf/gists{/gist_id}","starred_url":"https://api.github.com/users/behlendorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behlendorf/subscriptions","organizations_url":"https://api.github.com/users/behlendorf/orgs","repos_url":"https://api.github.com/users/behlendorf/repos","events_url":"https://api.github.com/users/behlendorf/events{/privacy}","received_events_url":"https://api.github.com/users/behlendorf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/behlendorf/zfs","description":"Native ZFS for Linux","fork":true,"url":"https://api.github.com/repos/behlendorf/zfs","forks_url":"https://api.github.com/repos/behlendorf/zfs/forks","keys_url":"https://api.github.com/repos/behlendorf/zfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/behlendorf/zfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/behlendorf/zfs/teams","hooks_url":"https://api.github.com/repos/behlendorf/zfs/hooks","issue_events_url":"https://api.github.com/repos/behlendorf/zfs/issues/events{/number}","events_url":"https://api.github.com/repos/behlendorf/zfs/events","assignees_url":"https://api.github.com/repos/behlendorf/zfs/assignees{/user}","branches_url":"https://api.github.com/repos/behlendorf/zfs/branches{/branch}","tags_url":"https://api.github.com/repos/behlendorf/zfs/tags","blobs_url":"https://api.github.com/repos/behlendorf/zfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/behlendorf/zfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/behlendorf/zfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/behlendorf/zfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/behlendorf/zfs/statuses/{sha}","languages_url":"https://api.github.com/repos/behlendorf/zfs/languages","stargazers_url":"https://api.github.com/repos/behlendorf/zfs/stargazers","contributors_url":"https://api.github.com/repos/behlendorf/zfs/contributors","subscribers_url":"https://api.github.com/repos/behlendorf/zfs/subscribers","subscription_url":"https://api.github.com/repos/behlendorf/zfs/subscription","commits_url":"https://api.github.com/repos/behlendorf/zfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/behlendorf/zfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/behlendorf/zfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/behlendorf/zfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/behlendorf/zfs/contents/{+path}","compare_url":"https://api.github.com/repos/behlendorf/zfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/behlendorf/zfs/merges","archive_url":"https://api.github.com/repos/behlendorf/zfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/behlendorf/zfs/downloads","issues_url":"https://api.github.com/repos/behlendorf/zfs/issues{/number}","pulls_url":"https://api.github.com/repos/behlendorf/zfs/pulls{/number}","milestones_url":"https://api.github.com/repos/behlendorf/zfs/milestones{/number}","notifications_url":"https://api.github.com/repos/behlendorf/zfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/behlendorf/zfs/labels{/name}","releases_url":"https://api.github.com/repos/behlendorf/zfs/releases{/id}","deployments_url":"https://api.github.com/repos/behlendorf/zfs/deployments","created_at":"2011-07-05T22:51:43Z","updated_at":"2017-04-08T07:22:18Z","pushed_at":"2017-08-10T23:28:25Z","git_url":"git://github.com/behlendorf/zfs.git","ssh_url":"git@github.com:behlendorf/zfs.git","clone_url":"https://github.com/behlendorf/zfs.git","svn_url":"https://github.com/behlendorf/zfs","homepage":"http://zfsonlinux.org/","size":41017,"stargazers_count":40,"watchers_count":40,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":0,"forks":6,"open_issues":0,"watchers":40,"default_branch":"master"}},"base":{"label":"zfsonlinux:master","ref":"master","sha":"21df134f4cb1c1e05eb89992b71573843df62b27","user":{"login":"zfsonlinux","id":575083,"avatar_url":"https://avatars3.githubusercontent.com/u/575083?v=4","gravatar_id":"","url":"https://api.github.com/users/zfsonlinux","html_url":"https://github.com/zfsonlinux","followers_url":"https://api.github.com/users/zfsonlinux/followers","following_url":"https://api.github.com/users/zfsonlinux/following{/other_user}","gists_url":"https://api.github.com/users/zfsonlinux/gists{/gist_id}","starred_url":"https://api.github.com/users/zfsonlinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfsonlinux/subscriptions","organizations_url":"https://api.github.com/users/zfsonlinux/orgs","repos_url":"https://api.github.com/users/zfsonlinux/repos","events_url":"https://api.github.com/users/zfsonlinux/events{/privacy}","received_events_url":"https://api.github.com/users/zfsonlinux/received_events","type":"Organization","site_admin":false},"repo":{"id":437011,"name":"zfs","full_name":"zfsonlinux/zfs","owner":{"login":"zfsonlinux","id":575083,"avatar_url":"https://avatars3.githubusercontent.com/u/575083?v=4","gravatar_id":"","url":"https://api.github.com/users/zfsonlinux","html_url":"https://github.com/zfsonlinux","followers_url":"https://api.github.com/users/zfsonlinux/followers","following_url":"https://api.github.com/users/zfsonlinux/following{/other_user}","gists_url":"https://api.github.com/users/zfsonlinux/gists{/gist_id}","starred_url":"https://api.github.com/users/zfsonlinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfsonlinux/subscriptions","organizations_url":"https://api.github.com/users/zfsonlinux/orgs","repos_url":"https://api.github.com/users/zfsonlinux/repos","events_url":"https://api.github.com/users/zfsonlinux/events{/privacy}","received_events_url":"https://api.github.com/users/zfsonlinux/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zfsonlinux/zfs","description":"ZFS on Linux - the official OpenZFS implementation for Linux.","fork":false,"url":"https://api.github.com/repos/zfsonlinux/zfs","forks_url":"https://api.github.com/repos/zfsonlinux/zfs/forks","keys_url":"https://api.github.com/repos/zfsonlinux/zfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zfsonlinux/zfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zfsonlinux/zfs/teams","hooks_url":"https://api.github.com/repos/zfsonlinux/zfs/hooks","issue_events_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/events{/number}","events_url":"https://api.github.com/repos/zfsonlinux/zfs/events","assignees_url":"https://api.github.com/repos/zfsonlinux/zfs/assignees{/user}","branches_url":"https://api.github.com/repos/zfsonlinux/zfs/branches{/branch}","tags_url":"https://api.github.com/repos/zfsonlinux/zfs/tags","blobs_url":"https://api.github.com/repos/zfsonlinux/zfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zfsonlinux/zfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zfsonlinux/zfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/zfsonlinux/zfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zfsonlinux/zfs/statuses/{sha}","languages_url":"https://api.github.com/repos/zfsonlinux/zfs/languages","stargazers_url":"https://api.github.com/repos/zfsonlinux/zfs/stargazers","contributors_url":"https://api.github.com/repos/zfsonlinux/zfs/contributors","subscribers_url":"https://api.github.com/repos/zfsonlinux/zfs/subscribers","subscription_url":"https://api.github.com/repos/zfsonlinux/zfs/subscription","commits_url":"https://api.github.com/repos/zfsonlinux/zfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/zfsonlinux/zfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/zfsonlinux/zfs/contents/{+path}","compare_url":"https://api.github.com/repos/zfsonlinux/zfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zfsonlinux/zfs/merges","archive_url":"https://api.github.com/repos/zfsonlinux/zfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zfsonlinux/zfs/downloads","issues_url":"https://api.github.com/repos/zfsonlinux/zfs/issues{/number}","pulls_url":"https://api.github.com/repos/zfsonlinux/zfs/pulls{/number}","milestones_url":"https://api.github.com/repos/zfsonlinux/zfs/milestones{/number}","notifications_url":"https://api.github.com/repos/zfsonlinux/zfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/labels{/name}","releases_url":"https://api.github.com/repos/zfsonlinux/zfs/releases{/id}","deployments_url":"https://api.github.com/repos/zfsonlinux/zfs/deployments","created_at":"2009-12-14T20:20:34Z","updated_at":"2017-08-10T06:47:14Z","pushed_at":"2017-08-10T23:30:41Z","git_url":"git://github.com/zfsonlinux/zfs.git","ssh_url":"git@github.com:zfsonlinux/zfs.git","clone_url":"https://github.com/zfsonlinux/zfs.git","svn_url":"https://github.com/zfsonlinux/zfs","homepage":"http://zfsonlinux.org/","size":39982,"stargazers_count":2601,"watchers_count":2601,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":628,"mirror_url":null,"open_issues_count":891,"forks":628,"open_issues":891,"watchers":2601,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495"},"html":{"href":"https://github.com/zfsonlinux/zfs/pull/6495"},"issue":{"href":"https://api.github.com/repos/zfsonlinux/zfs/issues/6495"},"comments":{"href":"https://api.github.com/repos/zfsonlinux/zfs/issues/6495/comments"},"review_comments":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495/comments"},"review_comment":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zfsonlinux/zfs/pulls/6495/commits"},"statuses":{"href":"https://api.github.com/repos/zfsonlinux/zfs/statuses/6104302b48924e84fab729784e64c389deddf2ec"}}}}
{"actor":{"display_login":"tuxoko"}}