Now
MAIN commitmail json YAML
src/sys/miscfs/specfs/spec_vnops.c@1.204
/
diff
/
nxr@1.204
src/sys/miscfs/specfs/specdev.h@1.50 / diff / nxr@1.50
src/sys/miscfs/specfs/specdev.h@1.50 / diff / nxr@1.50
specfs: Prevent new opens while close is waiting to drain.
Otherwise, bdev/cdev_close could have cancelled all _existing_ opens,
and waited for them to complete (and freed resources used by them) --
but a new one could start, and hang (e.g., a tty), at the same time
spec_close tries to drain all pending I/O operations, one of which
(the new open) is now hanging indefinitely.
Preventing the new open from even starting until bdev/cdev_close is
finished and all I/O operations have drained avoids this deadlock.
Otherwise, bdev/cdev_close could have cancelled all _existing_ opens,
and waited for them to complete (and freed resources used by them) --
but a new one could start, and hang (e.g., a tty), at the same time
spec_close tries to drain all pending I/O operations, one of which
(the new open) is now hanging indefinitely.
Preventing the new open from even starting until bdev/cdev_close is
finished and all I/O operations have drained avoids this deadlock.