Home | History | Annotate | Download | only in efs
History log of /src/sys/fs/efs/efs_vnops.c
RevisionDateAuthorComments
 1.44  06-Aug-2022  andvar s/blity/bility/ in various words, mainly in comments.
 1.43  18-Jul-2021  dholland Use macros for the canned parts of device and fifo vnode op tables.

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.
 1.42  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.41  27-Jun-2020  christos branches: 1.41.6;
Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.40  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.39  23-Apr-2020  ad PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of itself)

- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
somewhere. Use it to decide whether to do direct-mapped copy, rather than
poking around directly in the vnode in ubc_uiomove(), which is ugly and
doesn't work for tmpfs. It would be nicer to contain all this in UVM but
the filesystem provides the needed locking here (VV_MAPPED) and to
reinvent that would suck more.

- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS(). Pass in UBC_ISMAPPED where
appropriate.
 1.38  26-May-2017  riastradh branches: 1.38.20;
Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
 1.37  11-Apr-2017  riastradh Make VOP_INACTIVE preserve vnode lock on return.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
 1.36  20-Aug-2016  hannken branches: 1.36.2;
Remove now obsolete operation vcache_remove().

Welcome to 7.99.36
 1.35  07-Jul-2016  msaitoh branches: 1.35.2;
KNF. Remove extra spaces. No functional change.
 1.34  02-Mar-2016  christos PR/50883: David Binderman: Remove redundant code.
 1.33  07-Aug-2014  hannken branches: 1.33.4;
Change efs from hashlist to vcache.
 1.32  25-Jul-2014  dholland Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.31  07-Feb-2014  hannken branches: 1.31.2;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.30  18-Mar-2013  plunky branches: 1.30.6;
C99 section 6.7.2.3 (Tags) Note 3 states that:

A type specifier of the form

enum identifier

without an enumerator list shall only appear after the type it
specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
 1.29  20-Dec-2012  hannken Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.28  05-Nov-2012  dholland Excise struct componentname from the namecache.

This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
 1.27  05-Nov-2012  dholland Disentangle the namecache from the internals of namei.

- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

- It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

- Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
 1.26  22-Jul-2012  rmind branches: 1.26.2;
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
 1.25  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.24  19-May-2011  rmind branches: 1.24.4; 1.24.8; 1.24.10;
Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
 1.23  30-Nov-2010  dholland branches: 1.23.2;
Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
 1.22  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.21  29-Mar-2010  pooka Stop exposing fifofs internals and leave only fifo_vnodeop_p visible.
 1.20  03-Jul-2009  pooka branches: 1.20.2; 1.20.4;
Fix utterly botched previous commit. efs compiles now and apprears
to work, but the person doing the original change should verify
that it actually works like before the change.

(hi, elad!)
 1.19  03-Jul-2009  elad Where possible, extract the file-system's access() routine to two internal
functions: the first checking if the operation is possible (regardless of
permissions), the second checking file-system permissions, ACLs, etc.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
 1.18  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.17  01-Dec-2008  pooka branches: 1.17.4;
Add specfs/fifofs support. Not really fully tested, but at least
vfs routines don't crash now.
(didn't have an image with matching device node numbers)

fixes PR kern/40055 by myself
 1.16  26-Nov-2008  pooka Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
 1.15  16-Nov-2008  pooka more <sys/buf.h> police
 1.14  25-Jan-2008  ad branches: 1.14.6; 1.14.10; 1.14.16; 1.14.18; 1.14.20;
Remove VOP_LEASE. Discussed on tech-kern.
 1.13  02-Jan-2008  ad Merge vmlocking2 to head.
 1.12  26-Nov-2007  pooka branches: 1.12.2; 1.12.6;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.11  10-Oct-2007  ad branches: 1.11.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.10  08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.9  24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.8  08-Sep-2007  rumble branches: 1.8.2;
In efs_readdir don't foolishly allocate and free dirents for each entry
before copying them out, rather just use a single one. Further, follow
the example of tmpfs and others by simply allocating on the stack.

This should have the side-effect of silencing false Coverity reports like
CID 4559 and 4554.
 1.7  08-Sep-2007  rumble CID 4553:

In efs_lookup, when checking whether a CREATE or RENAME operation would
succeed, be sure to pass the appropriate vnode pointer to VOP_ACCESS.
 1.6  29-Jul-2007  rumble branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10;
Only set *ap->a_cookies when we're returning success. Also, do not hard-
code 16, but rather use _DIRENT_MINSIZE as the divisor when determining
the number of cookies to allocate.

Noticed by pooka@.
 1.5  29-Jul-2007  rumble Support NFS cookies and the eofflag in efs_readdir. Also, be sure to
update uio->uio_offset as not doing so would cause large directory reads
to misbehave.

EFS is now properly NFS-exportable.
 1.4  29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.3  04-Jul-2007  rumble branches: 1.3.2; 1.3.4;
Additional fixes/enhancements:
1) Comply with the way buffercache(9) is intended to be used. Now we
read in single blocks of EFS_BB_SIZE, never taking in variable
length extents with a single bread() call.

2) Handle symlinks with more than one extent. There's no reason for
this to ever happen, but it's handled now.

3) Finally, add a hint to our iteration initialiser so we can start
from the desired offset, rather than naively looping through from
the beginning each time. Since we can binary search the correct
location quickly, this improves large sequential reads by about
40% with 128MB files. Improvement should increase with file size.
 1.2  04-Jul-2007  rumble Fix a significant performance bug in efs_read:

When reading a file, we would erroneously iterate to the next extent
before having filled the entire uio request. This lead to unnecessary
extent iteration and excessive calls to efs_read.

Sequential read performance has doubled in the uncached case and
quadrupled when data is buffered.
 1.1  29-Jun-2007  rumble Add read-only support for SGI's Extent File System.

Reviewed by pooka@.
 1.3.4.2  10-Sep-2007  skrll Sync with HEAD.
 1.3.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.3.2.7  09-Oct-2007  ad Sync with head.
 1.3.2.6  09-Oct-2007  ad Sync with head.
 1.3.2.5  16-Sep-2007  ad Checkpoint work in progress on the vnode lifecycle and reference counting
stuff. This makes it work properly without kernel_lock and fixes a few
quite old bugs. See vfs_subr.c 1.283.2.17 for details.
 1.3.2.4  20-Aug-2007  ad Sync with HEAD.
 1.3.2.3  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.3.2.2  15-Jul-2007  ad Sync with head.
 1.3.2.1  04-Jul-2007  ad file efs_vnops.c was added on branch vmlocking on 2007-07-15 16:15:30 +0000
 1.6.10.2  29-Jul-2007  rumble Only set *ap->a_cookies when we're returning success. Also, do not hard-
code 16, but rather use _DIRENT_MINSIZE as the divisor when determining
the number of cookies to allocate.

Noticed by pooka@.
 1.6.10.1  29-Jul-2007  rumble file efs_vnops.c was added on branch matt-mips64 on 2007-07-29 20:58:11 +0000
 1.6.8.6  04-Feb-2008  yamt sync with head.
 1.6.8.5  21-Jan-2008  yamt sync with head
 1.6.8.4  07-Dec-2007  yamt sync with head
 1.6.8.3  27-Oct-2007  yamt sync with head.
 1.6.8.2  03-Sep-2007  yamt sync with head.
 1.6.8.1  29-Jul-2007  yamt file efs_vnops.c was added on branch yamt-lazymbuf on 2007-09-03 14:40:16 +0000
 1.6.6.3  23-Mar-2008  matt sync with HEAD
 1.6.6.2  09-Jan-2008  matt sync with HEAD
 1.6.6.1  06-Nov-2007  matt sync with HEAD
 1.6.4.3  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.6.4.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.6.4.1  02-Oct-2007  joerg Sync with HEAD.
 1.8.2.2  14-Oct-2007  yamt sync with head.
 1.8.2.1  06-Oct-2007  yamt sync with head.
 1.11.4.2  18-Feb-2008  mjf Sync with HEAD.
 1.11.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.12.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.12.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.14.20.4  06-Jan-2009  snj Apply patch (requested by rumble in ticket #216):
Adjust for the netbsd-5 branch by defining UBC_UNMAP_FLAG.
 1.14.20.3  06-Jan-2009  snj Pull up following revision(s) (requested by rumble in ticket #216):
sys/fs/efs/efs_vfsops.c: revision 1.17
sys/fs/efs/efs_vnops.c: revision 1.17
Add specfs/fifofs support. Not really fully tested, but at least
vfs routines don't crash now.
(didn't have an image with matching device node numbers)
fixes PR kern/40055 by myself
 1.14.20.2  06-Jan-2009  snj Pull up following revision(s) (requested by rumble in ticket #216):
sys/fs/efs/efs_vnops.c: revision 1.16
Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
 1.14.20.1  06-Jan-2009  snj Pull up following revision(s) (requested by rumble in ticket #216):
sys/fs/efs/efs_vnops.c: revision 1.15
more <sys/buf.h> police
 1.14.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.14.16.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.10.3  11-Aug-2010  yamt sync with head.
 1.14.10.2  18-Jul-2009  yamt sync with head.
 1.14.10.1  04-May-2009  yamt sync with head.
 1.14.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.17.4.1  23-Jul-2009  jym Sync with HEAD.
 1.20.4.4  31-May-2011  rmind sync with head
 1.20.4.3  05-Mar-2011  rmind sync with head
 1.20.4.2  03-Jul-2010  rmind sync with head
 1.20.4.1  30-May-2010  rmind sync with head
 1.20.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.20.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.23.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.24.10.1  12-Aug-2012  martin Pull up following revision(s) (requested by manu in ticket #484):
sys/fs/nilfs/nilfs_vnops.c: revision 1.18
sys/ufs/ufs/ufs_lookup.c: revision 1.117
sys/nfs/nfs_vnops.c: revision 1.295
sys/ufs/chfs/chfs_vnops.c: revision 1.8
sys/ufs/ext2fs/ext2fs_lookup.c: revision 1.70
sys/fs/unionfs/unionfs_vnops.c: revision 1.6
sys/kern/vfs_cache.c: revision 1.89
sys/fs/efs/efs_vnops.c: revision 1.26
sys/fs/hfs/hfs_vnops.c: revision 1.26
sys/fs/adosfs/adlookup.c: revision 1.16
sys/fs/puffs/puffs_vnops.c: revision 1.168
sys/fs/tmpfs/tmpfs_vnops.c: revision 1.98
sys/fs/ntfs/ntfs_vnops.c: revision 1.52
sys/fs/cd9660/cd9660_lookup.c: revision 1.20
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.24
sys/fs/smbfs/smbfs_vnops.c: revision 1.80
sys/fs/udf/udf_vnops.c: revision 1.72
sys/fs/filecorefs/filecore_lookup.c: revision 1.14
sys/fs/puffs/puffs_node.c: revision 1.25
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.
No objection on tech-kern@.
 1.24.8.1  05-Apr-2012  mrg sync to latest -current.
 1.24.4.5  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.24.4.4  23-Jan-2013  yamt sync with head
 1.24.4.3  16-Jan-2013  yamt sync with (a bit old) head
 1.24.4.2  30-Oct-2012  yamt sync with head
 1.24.4.1  17-Apr-2012  yamt sync with head
 1.26.2.5  03-Dec-2017  jdolecek update from HEAD
 1.26.2.4  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.2.3  23-Jun-2013  tls resync from head
 1.26.2.2  25-Feb-2013  tls resync with head
 1.26.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.6.1  18-May-2014  rmind sync with head
 1.31.2.1  10-Aug-2014  tls Rebase.
 1.33.4.4  28-Aug-2017  skrll Sync with HEAD
 1.33.4.3  05-Oct-2016  skrll Sync with HEAD
 1.33.4.2  09-Jul-2016  skrll Sync with HEAD
 1.33.4.1  19-Mar-2016  skrll Sync with HEAD
 1.35.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.36.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.38.20.1  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.41.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed