Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

uv_fs: EAGAIN is no hard error when probing Async IO. #485

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/uv_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,13 @@ static int probeAsyncIO(int fd, size_t size, bool *ok, char *errmsg)
* since we allocated the file with posix_fallocate and the block size
* is supposed to be correct. */
*ok = false;
if (event.res == -EAGAIN) {
/* If EAGAIN is encountered we assume the functionality is supported
* but this write would have blocked for some reason. UvWriter has a
* fallback mechanism to schedule writes on the thread pool in case
* the async write fails with EAGAIN, so this is safe. */
*ok = true;
}
}

return 0;
Expand Down
6 changes: 0 additions & 6 deletions test/unit/test_uv_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,6 @@ TEST(UvWriterClose, aio, setUp, tearDownDeps, 0, DirAioParams)
{
struct fixture *f = data;
SKIP_IF_NO_FIXTURE;
/* FIXME: btrfs doesn't like that we perform a first write to the probe file
* to detect the direct I/O buffer size. */
if (strcmp(munit_parameters_get(params, DIR_FS_PARAM), "btrfs") == 0) {
WRITE_CLOSE(1, 0, 0, 0);
return MUNIT_OK;
}
WRITE_CLOSE(1, 0, 0, RAFT_CANCELED);
return MUNIT_OK;
}
Loading