Page MenuHomeFreeBSD

aio_waitcomplete(2) should not sleep when timeout is not NULL, but set to 0.
ClosedPublic

Authored by pjd on Oct 5 2015, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 7:11 PM
Unknown Object (File)
Sat, Dec 7, 12:07 AM
Unknown Object (File)
Thu, Nov 28, 8:58 AM
Unknown Object (File)
Nov 23 2024, 10:42 AM
Unknown Object (File)
Nov 22 2024, 6:11 AM
Unknown Object (File)
Nov 10 2024, 7:51 AM
Unknown Object (File)
Nov 6 2024, 10:41 PM
Unknown Object (File)
Oct 30 2024, 1:17 PM
Subscribers
None

Details

Reviewers
jhb

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

pjd retitled this revision from to aio_waitcomplete(2) should not sleep when timeout is not NULL, but set to 0..
pjd updated this object.
pjd edited the test plan for this revision. (Show Details)
pjd added a reviewer: jhb.
sys/kern/vfs_aio.c
2511

Maybe make a smaller diff by checking for timo == -1 in here? That is, just

while (...) {
    if (timo == -1) {
        error = EWOULDBLOCK;
        break;
    }
}

I've seen this pattern in other places in the kernel. Often the sleep is done in the else in this case. Also, even though EGAIN == EWOULDBLOCK on FreeBSD, EWOULDBLOCK (or EINPROGRESS) better matches the existing error descriptions in the aio_waitcomplete(2) manpage. It is also what other places in the kernel use when skipping a sleep due to a poll.

Also, this thing should just be converting the timespec directly to an sbintime_t and using mtx_sleep_sbt() or whatever it is called.

In D3814#78778, @jhb wrote:

Also, this thing should just be converting the timespec directly to an sbintime_t and using mtx_sleep_sbt() or whatever it is called.

Though that can be done in a follow up change (sorry, meant to say that originally)

pjd edited edge metadata.

Thanks John, both good suggestions.

jhb edited edge metadata.
This revision is now accepted and ready to land.Oct 22 2015, 12:32 AM