Message ID | f664529a996a01479aa3ed14d33a1cf8d92afa8e.1437743468.git.zhaolei@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Fri, Jul 24, 2015 at 09:16:25PM +0800, Zhaolei wrote: > From: Zhao Lei <zhaolei@cn.fujitsu.com> Good catch! > We can reproduce this bug by a simple script: > DEV=/dev/vdh > for ((i = 0; i < 100; i++)); do > echo "loop $i" > mkfs.ext4 "$DEV" &>/dev/null || { echo mkfs fail; break; } > btrfs-convert "$DEV" || break > done Can you please turn it into a testing script? Just put it into the misc tests and add the usual preamble and paths. I'll apply this series, so separate patch please, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/task-utils.c b/task-utils.c index 10e3f0f..0390a69 100644 --- a/task-utils.c +++ b/task-utils.c @@ -50,9 +50,7 @@ int task_start(struct task_info *info) ret = pthread_create(&info->id, NULL, info->threadfn, info->private_data); - if (ret == 0) - pthread_detach(info->id); - else + if (ret) info->id = -1; return ret; @@ -66,8 +64,10 @@ void task_stop(struct task_info *info) if (info->periodic.timer_fd) close(info->periodic.timer_fd); - if (info->id > 0) + if (info->id > 0) { pthread_cancel(info->id); + pthread_join(info->id, NULL); + } if (info->postfn) info->postfn(info->private_data);