Skip to content

Commit

Permalink
OS-4656 nested epoll does not mimic Linux behavior
Browse files Browse the repository at this point in the history
Reviewed by: Bryan Cantrill <bryan@joyent.com>
  • Loading branch information
pfmooney committed Sep 18, 2015
1 parent 571f94b commit 1cf3b4f
Show file tree
Hide file tree
Showing 10 changed files with 814 additions and 171 deletions.
5 changes: 4 additions & 1 deletion usr/src/uts/common/brand/lx/io/lx_ptm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,10 @@ lx_ptm_poll_loop(dev_t dev, short events, int anyyet, short *reventsp,
* locks that we are already holding. So we need to
* drop those locks here before we do our read.
*/
lockstate = pollunlock();
if (pollunlock(&lockstate) != 0) {
*reventsp = POLLNVAL;
return (0);
}
err = lx_ptm_eof_drop(dev, &rval);
pollrelock(lockstate);
if (err)
Expand Down
7 changes: 5 additions & 2 deletions usr/src/uts/common/fs/fifofs/fifovnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

/*
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
* Copyright 2015, Joyent, Inc.
*/

/*
Expand Down Expand Up @@ -1775,7 +1775,10 @@ fifo_poll(vnode_t *vp, short events, int anyyet, short *reventsp,
fn_dest = fnp->fn_dest;
fn_lock = fnp->fn_lock;

polllock(&stp->sd_pollist, &fn_lock->flk_lock);
if (polllock(&stp->sd_pollist, &fn_lock->flk_lock) != 0) {
*reventsp = POLLNVAL;
return (0);
}

/*
* see if FIFO/pipe open
Expand Down
6 changes: 5 additions & 1 deletion usr/src/uts/common/fs/proc/prvnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -6099,7 +6099,11 @@ prpoll(vnode_t *vp, short events, int anyyet, short *reventsp,
return (0);
}

lockstate = pollunlock(); /* avoid deadlock with prnotify() */
/* avoid deadlock with prnotify() */
if (pollunlock(&lockstate) != 0) {
*reventsp = POLLNVAL;
return (0);
}

if ((error = prlock(pnp, ZNO)) != 0) {
pollrelock(lockstate);
Expand Down
Loading

0 comments on commit 1cf3b4f

Please sign in to comment.