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.

Details

Reviewers
jhb

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pjd updated this revision to Diff 9161.Oct 5 2015, 5:04 PM
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.
jhb added inline comments.Oct 5 2015, 7:24 PM
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.

jhb edited edge metadata.Oct 5 2015, 7:25 PM

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

jhb added a comment.Oct 5 2015, 7:25 PM
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 updated this revision to Diff 9595.Oct 21 2015, 9:27 PM
pjd edited edge metadata.

Thanks John, both good suggestions.

jhb accepted this revision.Oct 22 2015, 12:32 AM
jhb edited edge metadata.
This revision is now accepted and ready to land.Oct 22 2015, 12:32 AM
pjd closed this revision.Dec 29 2015, 4:20 PM