='index, nofollow'/>
summaryrefslogtreecommitdiff
path: root/sys/miscfs/specfs/specdev.h
AgeCommit message (Collapse)Author
2023-04-22Remove unused specdev member sd_rdev.hannken
Ride 10.99.4
2022-10-26miscfs/specfs/specdev.h: New home for extern spec_vnodeop_opv_desc.riastradh
Also use it for extern spec_vnodeop_p, which is already there.
2022-03-28specfs: Reorder struct specnode members to save padding.riastradh
Shrinks from 40 bytes to 32 bytes on LP64 systems this way.
2022-03-28specfs: Let spec_node_lookup_by_dev wait for reclaim to finish.riastradh
vdevgone relies on this to ensure that if there is a concurrent revoke in progress, it will wait for that revoke to finish -- that way, it can guarantee all I/O operations have completed and the device is closed.
2022-03-28specfs: Prevent new opens while close is waiting to drain.riastradh
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.
2022-03-28specfs: Drain all I/O operations after last .d_close call.riastradh
New kind of I/O reference on specdevs, sd_iocnt. This could be done with psref instead; I chose a reference count instead for now because we already have to take a per-object lock anyway, v_interlock, for vdead_check, so another atomic is not likely to hurt much more. We can always change the mechanism inside spec_io_enter/exit/drain later on. Make sure every access to vp->v_rdev or vp->v_specnode and every call to a devsw operation is protected either: - by the vnode lock (with vdead_check if we unlocked/relocked), - by positive sd_opencnt, - by spec_io_enter/exit, or - by sd_opencnt management in open/close.
2022-03-28specfs: Resolve a race between close and a failing reopen.riastradh
2022-03-28specfs: Document sn_opencnt, sd_opencnt, sd_refcnt.riastradh
2021-07-18Abolish all the silly indirection macros for initializing vnode ops tables.dholland
These are things of the form #define foofs_op genfs_op, or #define foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides obfuscation, and have gotten cutpasted all over everywhere.
2021-07-18Use macros for the canned parts of device and fifo vnode op tables.dholland
Add GENFS_SPECOP_ENTRIES and GENFS_FIFOOP_ENTRIES macros that contain the portion of the vnode ops table declaration that is (conservatively) the same in every fs. Use these in every fs that supports devices and/or fifos with separate ops tables. Note that ptyfs works differently (it has one type of vnode with open-coded dispatch to the specfs code, which I haven't changed in this commit) and rump/librump/rumpvfs/rumpfs.c has an indirect dynamic dispatch that already does more or less the same thing, which I also haven't changed. Also note that this anticipates a few bits in the next changeset here and there, and adds missing but unreachable calls in some cases (e.g. most fses weren't defining whiteout on devices and fifos, but it isn't reachable there), and it changes parsepath on devices and fifos to genfs_badop from genfs_parsepath (but it's not reachable there either). It appears that devices in kernfs were missing kqfilter, so it's possible that if you try to use kqueue on /kern/rootdev that it'll explode. And finally note that the ops declaration tables aren't order-dependent. (Other than vop_default_desc has to come first.) Otherwise this wouldn't work.
2015-06-23Add a vfs_newvnode() method to deadfs and use it to createhannken
anonymous device vnodes with bdevvp() and cdevvp(). Implement spec_inactive() and spec_reclaim() to handle these nodes.
2014-07-25Implement spec_fdiscard() using bdev_discard() and cdev_discard().dholland
Also define spec_fallocate() to genfs_eopnotsupp().
2013-09-30Replace macro v_specmountpoint with two functions spec_node_getmountedfs()hannken
and spec_node_setmountedfs() to manage the file system mounted on a device. Assert the device is a block device. Welcome to 6.99.24 Discussed on tech-kern@ some time ago. Reviewed by: David Holland <dholland@netbsd.org>
2013-04-21add missing spec_whiteoutdholland
2013-02-13Make the spec_node table implementation private to spec_vnops.c.hannken
To retrieve a spec_node, two new lookup functions (by device or by mount) are implemented. Both return a referenced vnode, for an opened block device the opened vnode is returned so further diagnostic checks "vp == ... sd_bdevvp" will not fire. Otherwise any vnode matching the criteria gets returned. No objections on tech-kern. Welcome to 6.99.17
2009-11-14- Move kauth_init() a little bit higher.elad
- Add spec_init() to authorize special device actions (and passthru too for the time being). Move policy out of secmodel_suser.
2009-10-06Factor out a block of code that appears in three places (Veriexec, keylock,elad
and securelevel) so that others can use it as well.
2008-12-29Rename specfs_lock as device_lock and move it from specfs to devsw.pooka
Relaxes kernel dependency on vfs.
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2008-01-25Remove VOP_LEASE. Discussed on tech-kern.ad
2008-01-24specfs changes for PR kern/37717 (raidclose() is no longer called onad
shutdown). There are still problems with device access and a PR will be filed. - Kill checkalias(). Allow multiple vnodes to reference a single device. - Don't play dangerous tricks with block vnodes to ensure that only one vnode can describe a block device. Instead, prohibit concurrent opens of block devices. As a bonus remove the unreliable code that prevents multiple file system mounts on the same device. It's no longer needed. - Track opens by vnode and by device. Issue cdev_close() when the last open goes away, instead of abusing vnode::v_usecount to tell if the device is open.
2007-10-07Update the file system copy-on-write handler.hannken
- Instead of hooking the handler on the specdev of a mounted file system hook directly on the `struct mount'. - Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'. Use `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'. - Replace the hand-made reader/writer lock with a krwlock. - Keep `vn_cow_*' functions and mark as obsolete. - Welcome to NetBSD 4.99.32 - `struct specinfo' changed size. Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-08-03cleanup unused prototypepooka
2007-07-22Retire uvn_attach() - it abuses VXLOCK and its functionality,pooka
setting vnode sizes, is handled elsewhere: file system vnode creation or spec_open() for regular files or block special files, respectively. Add a call to VOP_MMAP() to the pagedvn exec path, since the vnode is being memory mapped. reviewed by tech-kern & wrstuden
2006-05-14integrate kauth.elad
2005-12-11merge ktrace-lwp.christos
2005-11-02merge yamt-vop branch. remove following VOPs.yamt
VOP_BLKATOFF VOP_VALLOC VOP_BALLOC VOP_REALLOCBLKS VOP_VFREE VOP_TRUNCATE VOP_UPDATE
2005-08-30Remove __P()xtraeme
2004-05-25Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.hannken
- Not enabled by default. Needs kernel option FFS_SNAPSHOT. - Change parameters of ffs_blkfree. - Let the copy-on-write functions return an error so spec_strategy may fail if the copy-on-write fails. - Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock. - Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer. - Add a function ffs_checkfreefile needed for snapshot creation. - Add special handling of snapshot files: Snapshots may not be opened for writing and the attributes are read-only. Use the mtime as the time this snapshot was taken. Deny mtime updates for snapshot files. - Add function transferlockers to transfer any waiting processes from one lock to another. - Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through a vnode. - Add snapshot support to ls, fsck_ffs and dump. Welcome to 2.0F. Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-02-14Add a generic copy-on-write hook to add/remove functions that will behannken
called with every buffer written through spec_strategy(). Used by fss(4). Future file-system-internal snapshots will need them too. Welcome to 1.6ZK Approved by: Jason R. Thorpe <thorpej@netbsd.org>