diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2023-05-19 11:03:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 11:03:17 +0200 |
commit | ef6a9a624df0a00687037474025a3608472f722a (patch) | |
tree | 37974c87c23bb014470e9f47136405797244b61f | |
parent | d23a20f62cc50b9fd7694992263f1d296d8f5cb4 (diff) | |
download | libuv-ef6a9a624df0a00687037474025a3608472f722a.tar.gz libuv-ef6a9a624df0a00687037474025a3608472f722a.zip |
linux: fix WRITEV with lots of bufs using io_uring (#4004)
In the case of trying to write more than `IOV_MAX` buffers, the
`IORING_OP_WRITEV` operation will return `EINVAL`. As a temporal fix,
fallback to the old ways. In the future we might implement this by
linking multiple `IORING_OP_WRITEV` requests using `IOSQE_IO_LINK`.
-rw-r--r-- | src/unix/linux.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/unix/linux.c b/src/unix/linux.c index e7e7a111..a3439184 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -782,6 +782,11 @@ int uv__iou_fs_read_or_write(uv_loop_t* loop, struct uv__io_uring_sqe* sqe; struct uv__iou* iou; + /* For the moment, if iovcnt is greater than IOV_MAX, fallback to the + * threadpool. In the future we might take advantage of IOSQE_IO_LINK. */ + if (req->nbufs > IOV_MAX) + return 0; + iou = &uv__get_internal_fields(loop)->iou; sqe = uv__iou_get_sqe(iou, loop, req); |