summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-03-02 21:47:13 -0700
committerJens Axboe <axboe@kernel.dk>2020-03-02 21:48:46 -0700
commit044e585027d2094d27379872acb8d06b13175522 (patch)
tree8c7182025b072550ef0c5dbdc9ea07f7871703f5
parent417017d6a1110c3d51cd8ec5c70b88ad92a3b3ce (diff)
downloadliburing-044e585027d2094d27379872acb8d06b13175522.tar.gz
liburing-044e585027d2094d27379872acb8d06b13175522.tar.bz2
test/send_recvmsg: cleanup on abort
If we don't have PROVIDE_BUFFERS, then ensure we free the ring, and (more importantly) up the mutex so we don't hang. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/send_recvmsg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/send_recvmsg.c b/test/send_recvmsg.c
index e89e638..f28f737 100644
--- a/test/send_recvmsg.c
+++ b/test/send_recvmsg.c
@@ -162,7 +162,7 @@ static void *recv_fn(void *data)
io_uring_cqe_seen(&ring, cqe);
if (ret == -EINVAL) {
fprintf(stdout, "PROVIDE_BUFFERS not supported, skip\n");
- ret = 0;
+ goto out;
goto err;
} else if (ret < 0) {
fprintf(stderr, "PROVIDER_BUFFERS %d\n", ret);
@@ -183,6 +183,10 @@ static void *recv_fn(void *data)
err:
return (void *)(intptr_t)ret;
+out:
+ pthread_mutex_unlock(mutex);
+ io_uring_queue_exit(&ring);
+ return NULL;
}
static int do_sendmsg(void)
@@ -296,6 +300,5 @@ int main(int argc, char *argv[])
return 1;
}
-
return 0;
}