Home | History | Annotate | Download | only in genfs
History log of /src/sys/miscfs/genfs/genfs.h
RevisionDateAuthorComments
 1.39  27-Mar-2022  christos dedup the eofs link/symlink methods
 1.38  20-Oct-2021  thorpej Overhaul of the EVFILT_VNODE kevent(2) filter:

- Centralize vnode kevent handling in the VOP_*() wrappers, rather than
forcing each individual file system to deal with it (except VOP_RENAME(),
because VOP_RENAME() is a mess and we currently have 2 different ways
of handling it; at least it's reasonably well-centralized in the "new"
way).
- Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ,
compatible with the same events in FreeBSD.
- Track which kevent notifications clients are interested in receiving
to avoid doing work for events no one cares about (avoiding, e.g.
taking locks and traversing the klist to send a NOTE_WRITE when
someone is merely watching for a file to be deleted, for example).

In support of the above:

- Add support in vnode_if.sh for specifying PRE- and POST-op handlers,
to be invoked before and after vop_pre() and vop_post(), respectively.
Basic idea from FreeBSD, but implemented differently.
- Add support in vnode_if.sh for specifying CONTEXT fields in the
vop_*_args structures. These context fields are used to convey information
between the file system VOP function and the VOP wrapper, but do not
occupy an argument slot in the VOP_*() call itself. These context fields
are initialized and subsequently interpreted by PRE- and POST-op handlers.
- Version VOP_REMOVE(), uses the a context field for the file system to report
back the resulting link count of the target vnode. Return this in tmpfs,
udf, nfs, chfs, ext2fs, lfs, and ufs.

NetBSD 9.99.92.
 1.37  29-Jun-2021  dholland - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
- Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
 1.36  07-Aug-2020  christos branches: 1.36.6;
accmode should be accmode_t
 1.35  27-Jun-2020  christos Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.34  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.33  17-Feb-2017  hannken Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
 1.32  27-Feb-2014  hannken branches: 1.32.6; 1.32.10; 1.32.14;
The current implementation of vn_lock() is racy. Modification of
the vnode operations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Change deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
the vnode is locked and unlock and return ENOENT in this case.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Adresses PR kern/37706 (Forced unmount of file systems is unsafe)

Discussed on tech-kern.

Welcome to 6.99.33
 1.31  02-May-2013  riastradh branches: 1.31.4;
Fix (harmless) typo in struct genfs_rename_ops::gro_lookup prototype.
 1.30  08-May-2012  riastradh branches: 1.30.2;
Implement a genfs_rename abstraction.

First major step in incrementally adapting all the file systems to a
saner rename VOP protocol.
 1.29  13-Mar-2012  elad Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.28  30-Nov-2009  pooka branches: 1.28.12; 1.28.16; 1.28.18;
Introduce genfs_statvfs() as pretty much a no-info statvfs and
convert several pseudo file systems to use it.
 1.27  23-Jun-2009  elad Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
 1.26  07-May-2009  elad Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
 1.25  25-Apr-2009  elad Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
 1.24  22-Apr-2009  elad Per discussion on tech-kern@:

- Replace use of label/goto with returns

- Rename, change prototype of, and move functions from vfs_subr.c to
genfs_vnops.c
 1.23  28-Jan-2008  dholland branches: 1.23.10; 1.23.18; 1.23.24;
Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.
 1.22  25-Jan-2008  ad Remove VOP_LEASE. Discussed on tech-kern.
 1.21  24-Apr-2007  perseant branches: 1.21.8; 1.21.14;
Split the VOP interface part of genfs_putpages() from the code. The new
function that does the work, genfs_do_putpages(), now takes as an argument
a pointer to the page that would be waited on, if PGO_BUSYWAIT were not set.
This allows a consumer, e.g. lfs_putpages(), to perform an action outside
the scope of UVM before sleeping on the page in question.
 1.20  11-Dec-2005  christos branches: 1.20.24; 1.20.26; 1.20.30; 1.20.32; 1.20.38;
merge ktrace-lwp.
 1.19  02-Nov-2005  yamt merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.18  30-Aug-2005  xtraeme branches: 1.18.2;
Remove __P()
 1.17  10-Apr-2003  jdolecek branches: 1.17.2; 1.17.18;
use former genfs_eopnotsupp_rele() as genfs_eopnotsupp(), so that vnodes
are vput()/vrele()d as necessary - some filesystems did use the wrong
one for some ops, and it's just safer to not take the chance

based on suggestion by Bill Studenmund
 1.16  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.15  18-Dec-2001  chs add some compatibility routines to allow mmap() to work non-UBCified
filesystems (in the same non-coherent fashion that they worked before).
 1.14  06-Dec-2001  chs add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
 1.13  15-Sep-2001  chs a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.12  28-May-2001  chs branches: 1.12.2; 1.12.4;
add a genfs_mmap() and change all of the disk-based filesystems
to implement VOP_MMAP() with the genfs version, in preparation for
actually using this VOP.
 1.11  27-Nov-2000  chs branches: 1.11.2;
Initial integration of the Unified Buffer Cache project.
 1.10  03-Aug-1999  wrstuden branches: 1.10.2;
Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
 1.9  08-Jul-1999  wrstuden Introduce layer library in genfs. This set of files abstracts most of
the functionality of nullfs. The latter is now just a mount & unmount
routine, and a few tables. umapfs borrow most of this infrastructure.

Both fs's are now nfs-exportable.

All layered fs's share a common format to private mount & private
vnode structs (which a particular fs can extend).

Also add genfs_noerr_rele(), a vnode op which will vrele/vput
operand vnodes appropriately.
 1.8  13-Aug-1998  kleink branches: 1.8.8;
Add genfs_einval(), which does the obvious thing.
 1.7  10-Aug-1998  matthias create miscfs/genfs/genfs_vnops.c:genfs_enoioctl and make all the other
filesystems use it instead of a private version.
 1.6  25-Jun-1998  thorpej - Rename nqnfs_vop_lease_check() to genfs_lease_check(). If NFSSERVER is
not in the kernel, genfs_lease_check() is simply a no-op. This allows
LKM'd file systems to be exported (previously did not work properly
due to a compile-time decision based on -DNFSSERVER).
- defopt NFSSERVER
 1.5  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.4  05-Jan-1998  perry RCSID Police.
 1.3  11-Apr-1997  kleink Implement a POSIX compliant genfs VOP_SEEK() and use it in the appropriate
places; by Chris G. Demetriou and myself.
 1.2  07-Sep-1996  mycroft Implement poll(2).
 1.1  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.8.8.3  02-Aug-1999  thorpej Oops, some prototypes got nuked by mistake.
 1.8.8.2  02-Aug-1999  thorpej Update from trunk.
 1.8.8.1  04-Jul-1999  chs create genfs_getpages() and genfs_putpages().
these should be able to handle most of the local-disk filesystems.
 1.10.2.1  08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.4  11-Nov-2002  nathanw Catch up to -current
 1.11.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.11.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.11.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.12.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.12.2.3  25-Sep-2002  jdolecek implement genfs_kqfilter() - this is based upon ufs_kqfilter(), but uses
vp->v_size for EVFILT_READ
 1.12.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.1  10-Jul-2001  lukem prototype genfs_kqfilter()
 1.17.18.3  04-Feb-2008  yamt sync with head.
 1.17.18.2  03-Sep-2007  yamt sync with head.
 1.17.18.1  21-Jun-2006  yamt sync with head.
 1.17.2.1  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.1  20-Oct-2005  yamt remove genfs_fsync.
 1.20.38.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.20.32.1  11-Jul-2007  mjf Sync with head.
 1.20.30.1  08-Jun-2007  ad Sync with head.
 1.20.26.1  07-May-2007  yamt sync with head.
 1.20.24.1  05-Jun-2007  bouyer Pull up following revision(s) (requested by perseant in ticket #703):
sys/miscfs/genfs/genfs.h 1.21
sys/miscfs/genfs/genfs_vnops.c 1.151
sys/ufs/lfs/lfs.h 1.119, 1.120
sys/ufs/lfs/lfs_bio.c 1.99-101
sys/ufs/lfs/lfs_extern.h 1.89
sys/ufs/lfs/lfs_inode.c 1.108, 1.109
sys/ufs/lfs/lfs_segment.c 1.197, 1.199, 1.200
sys/ufs/lfs/lfs_subr.c 1.69, 1.70
sys/ufs/lfs/lfs_syscalls.c 1.119
sys/ufs/lfs/lfs_vfsops.c 1.234, 1.235
sys/ufs/lfs/lfs_vnops.c 1.195, 1.196, 1.200, 1.202-206

Reduce busy waiting in lfs_putpages(), and other LFS improvements.
 1.21.14.1  18-Feb-2008  mjf Sync with HEAD.
 1.21.8.1  23-Mar-2008  matt sync with HEAD
 1.23.24.2  23-Jul-2009  jym Sync with HEAD.
 1.23.24.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.18.1  28-Apr-2009  skrll Sync with HEAD.
 1.23.10.4  11-Mar-2010  yamt sync with head
 1.23.10.3  18-Jul-2009  yamt sync with head.
 1.23.10.2  16-May-2009  yamt sync with head
 1.23.10.1  04-May-2009  yamt sync with head.
 1.28.18.2  27-Oct-2014  msaitoh Pull up following revision(s) (requested by riastradh in ticket #1135):
sys/miscfs/genfs/genfs.h: revision 1.31
Fix (harmless) typo in struct genfs_rename_ops::gro_lookup prototype.
 1.28.18.1  02-Jul-2012  jdc Pull up revisions:
src/sys/conf/files revision 1.1050
src/sys/miscfs/genfs/genfs.h revision 1.30 via patch
src/sys/miscfs/genfs/genfs_rename.c revision 1.1 via patch
src/sys/rump/librump/rumpvfs/Makefile.rumpvfs revision 1.33
(requested by riastradh in ticket #286).

Implement a genfs_rename abstraction.

First major step in incrementally adapting all the file systems to a
saner rename VOP protocol.
 1.28.16.2  02-Jun-2012  mrg sync to latest -current.
 1.28.16.1  05-Apr-2012  mrg sync to latest -current.
 1.28.12.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.12.2  23-May-2012  yamt sync with head.
 1.28.12.1  17-Apr-2012  yamt sync with head
 1.30.2.3  03-Dec-2017  jdolecek update from HEAD
 1.30.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.2.1  23-Jun-2013  tls resync from head
 1.31.4.1  18-May-2014  rmind sync with head
 1.32.14.1  21-Apr-2017  bouyer Sync with HEAD
 1.32.10.1  20-Mar-2017  pgoyette Sync with HEAD
 1.32.6.1  28-Aug-2017  skrll Sync with HEAD
 1.36.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed