Home | History | Annotate | Download | only in mfs
History log of /src/sys/ufs/mfs/mfs_vnops.c
RevisionDateAuthorComments
 1.64  19-Mar-2022  hannken Switch MFS device node to real vnode locking, VV_LOCKSWORK now.
 1.63  18-Jul-2021  dholland Abolish all the silly indirection macros for initializing vnode ops tables.

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.
 1.62  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.61  16-May-2020  christos branches: 1.61.6;
Add ACL support for FFS. From FreeBSD.
 1.60  13-Apr-2020  ad Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed(). Signature matches
FreeBSD.
 1.59  20-Feb-2019  hannken branches: 1.59.10;
Remove superfluous VOP_UNLOCK(), vnode will be unlocked from spec_reclaim().
 1.58  26-May-2017  riastradh branches: 1.58.10;
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.57  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.56  14-Jan-2015  hannken branches: 1.56.2; 1.56.4;
Change mfs to use an anonymous vnode obtained with bdevvp()
for the specdev it mounts on.
 1.55  25-Jul-2014  dholland branches: 1.55.4;
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.54  24-Jun-2010  hannken branches: 1.54.18; 1.54.32;
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.53  13-Jan-2009  yamt branches: 1.53.4; 1.53.6;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.52  02-Jun-2008  christos branches: 1.52.6;
Revert to using specfs_fsync(); using a do-nothing mfs_fsync() does not work
because the filesystem cannot be unmounted since ffs_fsync() will loop forever
trying to empty the v_dirtyblkhd list.
 1.51  07-May-2008  ad mfs doesn't need fsync.
 1.50  06-May-2008  ad branches: 1.50.2;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.49  26-Mar-2008  ad branches: 1.49.2; 1.49.4;
Changes for PR kern/38291 (panic unmounting MFS /tmp):

- Reference count the mfsnode to fix an aincent bug. Only destroy when
reference count drops to zero. In mfs_start(), busy the mount and get
a reference to the mfsnode to prevent it disappearing while the server
is running. If the file system is gone already, vfs_busy() will fail.
- Always destroy the bufq.
- Use a global mfs_lock for simplicity.
- Replace use of malloc/free. Fixes broken MALLOC_TYPE change.
 1.48  21-Feb-2008  ad branches: 1.48.4;
Make MFS MP-safe. Needed because of the funny tricks it plays.
 1.47  17-Jan-2008  ad branches: 1.47.2;
mfs_close: remove a broken assertion.
 1.46  26-Nov-2007  pooka branches: 1.46.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.45  29-Jul-2007  ad branches: 1.45.4; 1.45.6; 1.45.12; 1.45.14;
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.44  04-Mar-2007  christos branches: 1.44.2; 1.44.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43  14-May-2006  elad branches: 1.43.14;
integrate kauth.
 1.42  11-Dec-2005  christos branches: 1.42.4; 1.42.6; 1.42.8; 1.42.10; 1.42.12;
merge ktrace-lwp.
 1.41  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.40  15-Oct-2005  yamt branches: 1.40.2;
- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.39  30-Aug-2005  xtraeme * Remove __P()
* Use ANSI function declarations on ext2fs and mfs
 1.38  26-Feb-2005  perry branches: 1.38.4;
nuke trailing whitespace
 1.37  28-Oct-2004  yamt branches: 1.37.4; 1.37.6;
move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.36  26-Jan-2004  hannken Fix mfs_strategy() to use the vp argument.
From YAMAMOTO Takashi <yamt@netbsd.org>.
 1.35  28-Dec-2003  dbj use symbolic V_SAVE instead of value 1 when invoking vinvalbuf
 1.34  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.33  29-Jun-2003  fvdl branches: 1.33.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.32  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.31  25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.30  19-Jul-2002  hannken Convert to new device buffer queue interface.
 1.29  06-Dec-2001  chs branches: 1.29.8;
add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
 1.28  08-Nov-2001  lukem add RCSID
 1.27  22-Jan-2001  jdolecek branches: 1.27.2; 1.27.6; 1.27.8; 1.27.10;
make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const
 1.26  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.25  09-Oct-2000  thorpej Make sure to set the residual count to 0 after a miniroot access
or after bitbucketing I/O during shutdown.
 1.24  11-Jun-2000  sommerfeld Bitbucket MFS I/O after vfs_shutdown has started..
 1.23  19-May-2000  thorpej branches: 1.23.2;
Back out previous change; there is something Seriously Wrong.
 1.22  16-May-2000  thorpej Redo the way MFS does I/O to the server's address space. Instead of
queueing up buffers and awakening the MFS server process to do the I/O,
we do the I/O to the server process's address space directly using
facilities provided by UVM.

This makes it possible for buffers attempting to flush out while the
MFS is being unmounted to actually do the I/O, where before it would
fail if the server process wasn't in the MFS idle loop (i.e. had been
signaled and was attempting to exit).

Should fix kern/10122 (I can no longer reproduce the problem described
in the PR when running with these changes), and any number of other
MFS-related complaints made by people over time.
 1.21  16-May-2000  thorpej Record the proc directly, not the pid, of the MFS server process,
and nuke the spare fields in the mfsnode.
 1.20  30-Mar-2000  augustss Remove register declarations.
 1.19  21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.18  01-Oct-1999  mycroft branches: 1.18.2; 1.18.8;
Fix printf() formats.
 1.17  03-Jul-1999  thorpej Nuke unneeded include file.
 1.16  15-Mar-1999  chs branches: 1.16.2; 1.16.4;
if an mfs i/o is successful, set b_resid to 0.
this allows the vnd driver to work on mfs files.
 1.15  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.14  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.13  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.12  12-Oct-1996  christos revert previous kprintf changes
 1.11  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10  07-Sep-1996  mycroft Implement poll(2).
 1.9  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  17-Mar-1996  christos Fix printf format strings
 1.7  21-Feb-1996  cgd in mfs_print: mfs_baseoff is a pointer, should be printed as %p, and
should NOT be cast to unsigned int.
 1.6  09-Feb-1996  christos mfs prototypes
 1.5  14-Dec-1994  mycroft Sync with CSRG.
 1.4  30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.3  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.2  18-Jun-1994  cgd kill #ifdefs for vax/tahoe w/old vm
 1.1  08-Jun-1994  mycroft branches: 1.1.1;
Update to 4.4-Lite fs code, with local changes.
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.16.4.1  02-Aug-1999  thorpej Update from trunk.
 1.16.2.1  10-Oct-1999  cgd pull up rev 1.18 from trunk (requested by mycroft):
Fix potential overflow of v_usecount and v_writecount (and panics
resulting from this) by widening them to `long'. Mostly affects
systems where maxvnodes>=32768.
 1.18.8.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.18.2.3  11-Feb-2001  bouyer Sync with HEAD.
 1.18.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.18.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.23.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.27.10.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.27.8.2  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.27.8.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.27.6.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.27.6.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.27.6.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.27.2.6  01-Aug-2002  nathanw Catch up to -current.
 1.27.2.5  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.27.2.4  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.27.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.27.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.27.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.29.8.1  20-Jul-2002  gehenna catch up with -current.
 1.33.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.33.2.5  02-Nov-2004  skrll Sync with HEAD.
 1.33.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.33.2.2  03-Aug-2004  skrll Sync with HEAD
 1.33.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.37.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.4.1  29-Apr-2005  kent sync with -current
 1.38.4.5  27-Feb-2008  yamt sync with head.
 1.38.4.4  21-Jan-2008  yamt sync with head
 1.38.4.3  07-Dec-2007  yamt sync with head
 1.38.4.2  03-Sep-2007  yamt sync with head.
 1.38.4.1  21-Jun-2006  yamt sync with head.
 1.40.2.1  20-Oct-2005  yamt adapt ufs.
 1.42.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.42.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.42.8.1  24-May-2006  yamt sync with head.
 1.42.6.1  01-Jun-2006  kardel Sync with head.
 1.42.4.1  09-Sep-2006  rpaulo sync with head
 1.43.14.1  12-Mar-2007  rmind Sync with HEAD.
 1.44.10.1  15-Aug-2007  skrll Sync with HEAD.
 1.44.2.2  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.44.2.1  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.45.14.2  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.45.14.1  29-Jul-2007  ad file mfs_vnops.c was added on branch matt-mips64 on 2007-07-29 13:31:17 +0000
 1.45.12.2  18-Feb-2008  mjf Sync with HEAD.
 1.45.12.1  08-Dec-2007  mjf Sync with HEAD.
 1.45.6.2  23-Mar-2008  matt sync with HEAD
 1.45.6.1  09-Jan-2008  matt sync with HEAD
 1.45.4.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.46.6.1  19-Jan-2008  bouyer Sync with HEAD
 1.47.2.1  24-Mar-2008  keiichi sync with head.
 1.48.4.3  17-Jan-2009  mjf Sync with HEAD.
 1.48.4.2  03-Apr-2008  mjf Sync with HEAD.
 1.48.4.1  21-Feb-2008  mjf file mfs_vnops.c was added on branch mjf-devfs2 on 2008-04-03 12:43:14 +0000
 1.49.4.3  11-Aug-2010  yamt sync with head.
 1.49.4.2  04-May-2009  yamt sync with head.
 1.49.4.1  16-May-2008  yamt sync with head.
 1.49.2.2  04-Jun-2008  yamt sync with head
 1.49.2.1  18-May-2008  yamt sync with head.
 1.50.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.52.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.53.6.1  03-Jul-2010  rmind sync with head
 1.53.4.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.54.32.1  10-Aug-2014  tls Rebase.
 1.54.18.2  03-Dec-2017  jdolecek update from HEAD
 1.54.18.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.4.2  28-Aug-2017  skrll Sync with HEAD
 1.55.4.1  06-Apr-2015  skrll Sync with HEAD
 1.56.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.56.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.58.10.2  21-Apr-2020  martin Sync with HEAD
 1.58.10.1  10-Jun-2019  christos Sync with HEAD
 1.59.10.1  20-Apr-2020  bouyer Sync with HEAD
 1.61.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed