linux: retry fs op if unsupported by io_uring (#4268)
Fallback to the threadpool if it returns `EOPNOTSUPP`. Fixes: https://github.com/nodejs/node/issues/50876
This commit is contained in:
parent
7d092913b3
commit
160cd5629e
@ -1630,6 +1630,16 @@ static void uv__fs_done(struct uv__work* w, int status) {
|
||||
}
|
||||
|
||||
|
||||
void uv__fs_post(uv_loop_t* loop, uv_fs_t* req) {
|
||||
uv__req_register(loop, req);
|
||||
uv__work_submit(loop,
|
||||
&req->work_req,
|
||||
UV__WORK_FAST_IO,
|
||||
uv__fs_work,
|
||||
uv__fs_done);
|
||||
}
|
||||
|
||||
|
||||
int uv_fs_access(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* path,
|
||||
|
||||
@ -425,6 +425,7 @@ UV_UNUSED(static int uv__stat(const char* path, struct stat* s)) {
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
void uv__fs_post(uv_loop_t* loop, uv_fs_t* req);
|
||||
ssize_t
|
||||
uv__fs_copy_file_range(int fd_in,
|
||||
off_t* off_in,
|
||||
|
||||
@ -1155,6 +1155,12 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) {
|
||||
uv__req_unregister(loop, req);
|
||||
iou->in_flight--;
|
||||
|
||||
/* If the op is not supported by the kernel retry using the thread pool */
|
||||
if (e->res == -EOPNOTSUPP) {
|
||||
uv__fs_post(loop, req);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* io_uring stores error codes as negative numbers, same as libuv. */
|
||||
req->result = e->res;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user