From 1353b1b9bbd6717c89e32883e87aa5cfe4cb04dc Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Fri, 29 Sep 2023 10:04:50 -0400 Subject: [PATCH] workqueue: handle nice better nice returns the program's schedule priority. This can be a negative value when there is no error condition. To check if nice is triggering an error we have to check errno. The most recent three macOS test failures appear to be due to this problem. https://github.com/axboe/fio/actions/runs/6347762639/job/17243247222 https://github.com/axboe/fio/actions/runs/6346019205/job/17239370410 https://github.com/axboe/fio/actions/runs/6241934089/job/16944981876 Signed-off-by: Vincent Fu --- workqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workqueue.c b/workqueue.c index 9e6c41ff..3636bc3a 100644 --- a/workqueue.c +++ b/workqueue.c @@ -136,7 +136,8 @@ static void *worker_thread(void *data) sk_out_assign(sw->sk_out); if (wq->ops.nice) { - if (nice(wq->ops.nice) < 0) { + errno = 0; + if (nice(wq->ops.nice) == -1 && errno != 0) { log_err("workqueue: nice %s\n", strerror(errno)); ret = 1; } -- 2.25.1