diff options
| author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> | 2019-06-17 07:27:53 -0700 |
|---|---|---|
| committer | John Levon <john.levon@joyent.com> | 2019-06-18 11:28:37 -0700 |
| commit | 430c2cddc92582fc7155aaf65c78f0919d7081c1 (patch) | |
| tree | ff2e362e959cd9bee49671326b3bc4487e538f81 /usr/src | |
| parent | 5f5c35baa7f18214d2cd9ec105270892288f8497 (diff) | |
| download | illumos-gate-430c2cddc92582fc7155aaf65c78f0919d7081c1.tar.gz | |
6474 getupeercred causes spurious event port wakeups on FIFOs
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Gergő Doma <domag02@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/uts/common/fs/fifofs/fifovnops.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/usr/src/uts/common/fs/fifofs/fifovnops.c b/usr/src/uts/common/fs/fifofs/fifovnops.c index ef8d76e8e8..c1b4652633 100644 --- a/usr/src/uts/common/fs/fifofs/fifovnops.c +++ b/usr/src/uts/common/fs/fifofs/fifovnops.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All rights reserved. */ +/* All rights reserved. */ /* @@ -565,11 +565,11 @@ fifo_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *crp, /* * If this a pipe and this is the first end to close, * then we have a bit of cleanup work to do. - * Mark both ends of pipe as closed. - * Wake up anybody blocked at the other end and for named pipes, + * Mark both ends of pipe as closed. + * Wake up anybody blocked at the other end and for named pipes, * Close down this end of the stream * Allow other opens/closes to continue - * force an unmount of other end. + * force an unmount of other end. * Otherwise if this is last close, * flush messages, * close down the stream @@ -1127,6 +1127,21 @@ fifo_ioctl(vnode_t *vp, int cmd, intptr_t arg, int mode, cred_t *cr, fifo_strioctl(vp, cmd, arg, mode, cr, rvalp)); } +static inline int +fifo_ioctl_getpeercred(fifonode_t *fnp, intptr_t arg, int mode) +{ + k_peercred_t *kp = (k_peercred_t *)arg; + + if (mode == FKIOCTL && fnp->fn_pcredp != NULL) { + crhold(fnp->fn_pcredp); + kp->pc_cr = fnp->fn_pcredp; + kp->pc_cpid = fnp->fn_cpid; + return (0); + } else { + return (ENOTSUP); + } +} + static int fifo_fastioctl(vnode_t *vp, int cmd, intptr_t arg, int mode, cred_t *cr, int *rvalp) @@ -1346,6 +1361,10 @@ fifo_fastioctl(vnode_t *vp, int cmd, intptr_t arg, int mode, cred_t *cr, *rvalp = 0; break; + case _I_GETPEERCRED: + error = fifo_ioctl_getpeercred(fnp, arg, mode); + break; + /* * invalid calls for stream head or fifos */ @@ -1393,17 +1412,8 @@ fifo_strioctl(vnode_t *vp, int cmd, intptr_t arg, int mode, cred_t *cr, int error; fifolock_t *fn_lock; - if (cmd == _I_GETPEERCRED) { - if (mode == FKIOCTL && fnp->fn_pcredp != NULL) { - k_peercred_t *kp = (k_peercred_t *)arg; - crhold(fnp->fn_pcredp); - kp->pc_cr = fnp->fn_pcredp; - kp->pc_cpid = fnp->fn_cpid; - return (0); - } else { - return (ENOTSUP); - } - } + if (cmd == _I_GETPEERCRED) + return (fifo_ioctl_getpeercred(fnp, arg, mode)); error = strioctl(vp, cmd, arg, mode, U_TO_K, cr, rvalp); |
