Bug 251515 - lio_listio(2) never sends kevent if nent==0
Summary: lio_listio(2) never sends kevent if nent==0
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-02 00:50 UTC by Alan Somers
Modified: 2020-12-30 03:03 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer 2020-12-02 00:50:09 UTC
It may seem stupid, but you can call lio_listio(2) with an empty aiocb list.  I would naively expect lio_listio to do nothing and return in that case.  Indeed, that's what it does when mode == LIO_WAIT.  However, if mode == LIO_NOWAIT and sigev_notify == SIGEV_KEVENT, no event is ever delivered.

The problem can be demonstrated by the sys/aio/lio_test:lio_listio_empty_nowait_kevent test case.

Since the Open Group's AIO specification never mentions kevent, we get to make the call on what to do.  jhb and I agree that sending immediate notification is sensible.

This was originally reported as bug 220398, but that bug really turned out to be two bugs.
Comment 1 commit-hook freebsd_committer 2020-12-02 00:53:39 UTC
A commit references this bug:

Author: asomers
Date: Wed Dec  2 00:53:03 UTC 2020
New revision: 368272
URL: https://svnweb.freebsd.org/changeset/base/368272

Log:
  AIO tests: update expected failure messages after r368265

  PR:		220398, 251515
  MFC after:	1 week
  MFC-With:	r368265

Changes:
  head/tests/sys/aio/lio_test.c
Comment 2 commit-hook freebsd_committer 2020-12-30 03:03:35 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0efb22eebbbbd5f164cab39dca72a78cce82afe3

commit 0efb22eebbbbd5f164cab39dca72a78cce82afe3
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2020-01-04 18:59:46 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2020-12-30 03:02:47 +0000

    MFC r356352, r368272

    lio_listio_empty_nowait_thread sometimes does *not* hang.

    The other tests consistently do hang though.

    Sponsored by:   DellEMC

    (cherry picked from commit 0cb4586a0be3b1b5909b73b24798032ddf2f4002)

    AIO tests: update expected failure messages after r368265

    PR:             220398, 251515

    (cherry picked from commit 23693bd8f3e36b4721d7b59d52154d3e3f49e3cd)

 tests/sys/aio/lio_test.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)