From 1e22d8b64e858e7f7bd77716b08dc46714133494 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 11 Nov 2014 18:10:28 +0100 Subject: [PATCH] bio: fix thread termination --- kernel/mars_bio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/mars_bio.c b/kernel/mars_bio.c index 0b379fc1..f15e7878 100644 --- a/kernel/mars_bio.c +++ b/kernel/mars_bio.c @@ -528,7 +528,10 @@ int bio_response_thread(void *data) int code; if (list_empty(&tmp_list)) { - if (brick_thread_should_stop()) + if (brick_thread_should_stop() && + atomic_read(&brick->fly_count[0]) + + atomic_read(&brick->fly_count[1]) + + atomic_read(&brick->fly_count[2]) <= 0) goto done; break; } @@ -763,6 +766,7 @@ static int bio_switch(struct bio_brick *brick) } if (brick->response_thread) { brick_thread_stop(brick->response_thread); + brick->response_thread = NULL; } brick->bdev = NULL; if (!brick->power.button) {