Project

General

Profile

Bug #12910

EPOLLONESHOT should not remove fd

Added by Patrick Mooney 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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 an ENOENT error, since it had been removed from the set. After writing up a test case (in the epoll-test-suite) which configures an EPOLLONESHOT watch, fires it, and then modifies it with EPOLL_CTL_MOD, I found that on Linux, the modification works fine, while on illumos it bails.

While this differs from the /dev/poll behavior for POLLONESHOT, 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.

History

#1

Updated by Electric Monk 3 months ago

  • Gerrit CR set to 764
#2

Updated by Patrick Mooney 3 months 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

#3

Updated by Patrick Mooney 3 months ago

  • Description updated (diff)
#4

Updated by Electric Monk 3 months 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>

Also available in: Atom PDF