Bug #12910
closedEPOLLONESHOT should not remove fd
100%
Description
Upstreaming OS-7107 (and OS-7479) from SmartOS:
While mike.zeller was investigating unrelated epoll failures in the (Rust) mio runtime, the involved tests indicated that our behavior for
EPOLLONESHOT
may not be correct. Specifically, after an epoll watch fires an event for a given fd, the software was trying to modify that watch, causing anENOENT
error, since it had been removed from the set. After writing up a test case (in the epoll-test-suite) which configures anEPOLLONESHOT
watch, fires it, and then modifies it withEPOLL_CTL_MOD
, I found that on Linux, the modification works fine, while on illumos it bails.While this differs from the
/dev/poll
behavior forPOLLONESHOT
, it should be fixed so that epoll semantics are preserved.The proposed wad passes LTP (as it did before). The
POLLONESHOT
portions of pmooney's epoll test suite, which previous failed, are now happy with the update. The other tests in the suite pass as well.The mio test suite, which originally uncovered this behavior, passes with the wad applied as well.
Updated by Patrick Mooney almost 2 years ago
Prior to integration of the change, the oneshot epoll test fails, as expected:
test_oneshot 0 TPASS test_oneshot 1 TPASS test_oneshot 2 TBROK: epoll_ctl(EPOLL_CTL_MOD): No such file or directory
With it applied, the test passes (with no regressions to the other tests):
test_oneshot 0 TPASS test_oneshot 1 TPASS test_oneshot 2 TPASS test_oneshot 3 TPASS
Updated by Electric Monk almost 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
git commit 95e434b588459fbd3ca313889cc0223436f1b0cd
commit 95e434b588459fbd3ca313889cc0223436f1b0cd Author: Patrick Mooney <pmooney@pfmooney.com> Date: 2020-07-07T18:10:23.000Z 12910 EPOLLONESHOT should not remove fd Reviewed by: Bryan Cantrill <bryan@joyent.com> Reviewed by: Mike Zeller <mike.zeller@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>