freebsd-skq/sys
kib d4a0747609 Restore flushing of output for revoke(2) again. Document revoke()'s
intended behaviour in its man page.  Simplify tty_drain() to match.
Don't call ttydevsw methods in tty_flush() if the device is gone
since we now sometimes call it then.

The flushing was supposed to be implemented by passing the FNONBLOCK
flag to VOP_CLOSE() for revoke().  The tty driver is one of the few
that can block in close and was one of the fewer that knew about this.

This almost worked in FreeBSD-1 and similarly in Net/2.  These
versions only almost worked because there was and is considerable
confusion between IO_NDELAY and FNONBLOCK (aka O_NONBLOCK).  IO_NDELAY
is only valid for VOP_READ() and VOP_WRITE().  For other VOPs it has
the same value as O_SHLOCK.  But since vfs_subr.c and tty.c
consistently used the wrong flag and the O_SHLOCK flag is rarely set,
this mostly worked.  It also gave the feature than applications could
get the non-blocking close by abusing O_SHLOCK.

This was first broken then fixed in 1995.  I changed only the tty
driver to use FNONBLOCK, as a hack to get non-blocking via the normal
flag FNONBLOCK for last closes.  I didn't know about revoke()'s use
of IO_NDELAY or change it to be consistent, so revoke() was broken.
Then I changed revoke() to match.

This was next broken in 1997 then fixed in 1998.  Importing Lite2 made
the flags inconsistent again by undoing the fix only in vfs_subr.c.

This was next broken in 2008 by replacing everything in tty.c and not
checking any flags in last close.  Other bugs in draining limited the
resulting unbounded waits to drain in some cases.

It is now possible to fix this better using the new FREVOKE flag.
Just restore flushing for revoke() for now.  Don't restore or undo any
hacks for ordinary last closes yet.  But remove dead code in the
1-second relative timeout (r272789).  This did extra work to extend
the buggy draining for revoke() for as long as possible.  The 1-second
timeout made this not very long by usually flushing after 1 second.

Submitted by:	bde
MFC after:	2 weeks
2016-01-26 07:57:44 +00:00
..
amd64 Remove obsolete comment. 2016-01-23 08:08:06 +00:00
arm Allow us to be told about memory past the first 4GB point, but ignore it. 2016-01-25 23:04:40 +00:00
arm64 Simplify GICv3 related drivers' naming 2016-01-25 15:18:32 +00:00
boot Allow new lines as white space for arguments that are parsed to allow 2016-01-26 06:26:56 +00:00
bsm Merge from contrib/openbsm to bring the kernel audit bits up to date with OpenBSM 1.2 alpha 4: 2015-12-20 23:22:04 +00:00
cam Hide "soconnect() error" messages under bootverbose. 2016-01-22 09:32:19 +00:00
cddl Fix ru_oublocks accounting for ZFS. There are two code paths that can be 2016-01-23 12:13:09 +00:00
compat Implement 64-bit atomic operations for the LinuxKPI. 2016-01-21 17:56:23 +00:00
conf Introduce support for HW watchpoints and single stepping for ARMv6/v7 2016-01-25 18:02:28 +00:00
contrib Fix order of last two arguments of mtx_init 2016-01-14 20:25:22 +00:00
crypto Break up opencrypto/xform.c so it can be reused piecemeal 2015-12-30 22:43:07 +00:00
ddb
dev - Make the code consistent with itself style-wise and bring it closer 2016-01-25 22:58:06 +00:00
fs ext2fs: passthrough any extra timestamps to the dinode struct. 2016-01-24 23:24:47 +00:00
gdb CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
geom Teach the flashmap code about the SPI flash. 2016-01-23 05:26:29 +00:00
gnu Fixing a memory leak on module unloading. 2015-09-11 22:43:35 +00:00
i386 Adjust i386 comment to match amd64 one after r294311. 2016-01-19 08:09:09 +00:00
isa
kern Restore flushing of output for revoke(2) again. Document revoke()'s 2016-01-26 07:57:44 +00:00
kgssapi Unset the gss kernel state when gssd exits 2016-01-01 17:06:16 +00:00
libkern
mips Remove a duplicate setting of the AH_DEBUG_ALQ option. 2016-01-26 01:16:45 +00:00
modules ext2fs: Bring back the htree dir_index implementation. 2016-01-21 14:50:28 +00:00
net Prune a definition which is / was never used. 2016-01-25 20:35:15 +00:00
net80211 net80211: reduce stack usage for ieee80211_ioctl*() methods. 2016-01-24 23:35:20 +00:00
netgraph Make ng_netflow(9) use new routing KPI. 2016-01-14 13:14:12 +00:00
netinet Convert TCP mtu checks to the new routing KPI. 2016-01-25 10:06:49 +00:00
netinet6 MFP r287070,r287073: split radix implementation and route table structure. 2016-01-25 06:33:15 +00:00
netipsec Overhaul if_enc(4) and make it loadable in run-time. 2015-11-25 07:31:59 +00:00
netnatm Provide includes that are needed in these files, and before were read 2013-10-26 18:18:50 +00:00
netpfil Revert one chunk from commit 285362, which introduced an off-by-one error 2016-01-26 04:48:24 +00:00
netsmb The problem report was for a crash that happened when smbfs was 2015-11-18 23:04:01 +00:00
nfs MFP r287070,r287073: split radix implementation and route table structure. 2016-01-25 06:33:15 +00:00
nfsclient Remove some oldnfs remnants. 2015-04-18 16:08:06 +00:00
nfsserver Use M_SIZE() instead of hand-crafted (and mostly correct) NFSMSIZ() macro 2015-01-07 17:22:56 +00:00
nlm
ofed Fix for iWARP servers that listen on INADDR_ANY. 2016-01-22 23:33:34 +00:00
opencrypto Break up opencrypto/xform.c so it can be reused piecemeal 2015-12-30 22:43:07 +00:00
pc98 Add asynchronous command support to the pass(4) driver, and the new 2015-12-03 20:54:55 +00:00
powerpc Older Book-E processors (e500v1/e500v2) don't support dcbzl. 2016-01-26 04:41:18 +00:00
riscv/include Correct RISC-V exception types. 2016-01-18 17:49:32 +00:00
rpc
security Busy the mount point which is the owner of the audit vnode, around 2016-01-16 10:06:33 +00:00
sparc64 Add an atomic_fetchadd_64() wrapper on sparc64. 2016-01-22 00:29:11 +00:00
sys - Make the code consistent with itself style-wise and bring it closer 2016-01-25 22:58:06 +00:00
teken Sync HPA and VPA implementations with CUP. 2015-08-24 07:49:27 +00:00
tests
tools
ufs Recheck curthread->td_su after the VFS_SYNC() call, and re-sync if the 2015-12-21 11:50:32 +00:00
vm Typo in comment. 2016-01-24 13:38:41 +00:00
x86 hyperv: use x86 generic code to do the hypervisor detection 2016-01-14 02:50:13 +00:00
xdr
xen xenbus: add a comment with the names of the generated accessors 2016-01-15 14:34:31 +00:00
Makefile Kill EoL whitespace. 2015-05-29 14:03:07 +00:00