Commit Graph

128 Commits

Author SHA1 Message Date
sommerfeld e964d558a7 Fix assorted bugs around shutdown/reboot/panic time.
- add a new global variable, doing_shutdown, which is nonzero if
vfs_shutdown() or panic() have been called.
- in panic, set RB_NOSYNC if doing_shutdown is already set on entry
so we don't reenter vfs_shutdown if we panic'ed there.
 - in vfs_shutdown, don't use proc0's process for sys_sync unless
curproc is NULL.
 - in lockmgr, attribute successful locks to proc0 if doing_shutdown
&& curproc==NULL, and  panic if we can't get the lock right away; avoids the
spurious lockmgr DIAGNOSTIC panic from the ddb reboot command.
 - in subr_pool, deal with curproc==NULL in the doing_shutdown case.
 - in mfs_strategy, bitbucket writes if doing_shutdown, so we don't
wedge waiting for the mfs process.
 - in ltsleep, treat ((curproc == NULL) && doing_shutdown) like the
panicstr case.

Appears to fix: kern/9239, kern/10187, kern/9367.
May also fix kern/10122.
2000-06-10 18:44:43 +00:00
assar 6c734cd283 make vfs_getnewfsid only take one argument and fetch the name of the
filesystem from the supplied mount argument.  also make makefstype
take a const parameter.  update all the callers.
2000-06-10 18:27:01 +00:00
mycroft 4656dfd24f Add a new function to remove extra buffers when truncating a file. This is
more generic than the vinvalbuf(V_SAVEMETA) case, avoiding synchronous
operations when truncating to a non-zero length.
2000-05-28 04:13:56 +00:00
chs 1c084aee4f add ddb commands for printing vnodes and bufs. 2000-04-10 02:22:13 +00:00
augustss c87c1861bb Add a special option, DEBUG_HALT_BUSY, that allows you to debug when the
system doesn't want to halt cleanly.  The code was there before, but only
with the DEBUG option.
2000-03-30 09:32:25 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
fvdl c3167b9545 Do previous better. Use FSYNC_RECLAIM as it was before. 2000-03-17 01:25:06 +00:00
jdolecek 89015c4648 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
2000-03-16 18:08:17 +00:00
fvdl 01db605567 Do the previous slightly different: any files on MNT_SOFTDEP filesystems do
not want all their metadata dependencies flushed from vinvalbuf() if
there are no dirty blocks.
2000-03-15 16:28:45 +00:00
perseant 61fa9e1409 Move vinvalbuf's check for dirty blocks into ffs_fsync, to ensure that
mode and ownership bits are flushed to disk before the vnode is
reclaimed.

The check, introduced in the softdep merge, assumes that if no blocks
are dirty, no file data *or metadata* needs to be flushed to disk.  This
is true of ffs, but is not true of lfs, and may not be true of other
filesystems.

Tested by myself and Bill Squier <groo@cs.stevens-tech.edu>.
2000-03-11 05:00:18 +00:00
mycroft 1d915f4130 Allow my disk to actually spin down using `-o async' again.
Note: This uses the same questionable logic as vfs_bio.c to check MNT_ASYNC.
Something needs to be done about this.
2000-03-03 05:21:03 +00:00
fvdl c13f6dd258 Introduce a sysctl to enable/disable if non-root users can mount filesystems.
Default: off.
2000-02-16 11:57:45 +00:00
perseant fa6a733240 In lfs_bwrite, don't mark buffers dirty if lfs is mounted read-only.
(Previously buffers could be marked dirty by the cleaner, and possibly by
other means.)

Also check for softdep mount in vfs_shutdown before trying to bawrite
buffers, since other filesystems don't need it and lfs doesn't bawrite.
(This fragment reviewed by fvdl.)

Partially addresses PR#8964.
1999-12-15 07:10:32 +00:00
fvdl d901f6eae0 Be more careful to block bio interrupts for some data structures. There
were at least a few missed cases where vp->v_{clean,dirty}blkhd were
unprotected since the softdep/trickle sync merge.
1999-11-23 23:52:40 +00:00
enami f6b8114fc7 Initialize the vnode_hold_list correctly. 1999-11-18 05:50:25 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
mycroft fde519b5e2 Widen usecount and writecount to prevent overflow. 1999-10-01 22:03:17 +00:00
mycroft 5e7ae44739 Correct spelling in an #ifdef. 1999-10-01 21:57:42 +00:00
wrstuden ba891a728d Deal with device vnodes which aren't on the spechash tables, rather than
panicing. So now we make sure vp->v_hashchain != NULL before removing
the node from the chain.
1999-08-20 22:21:25 +00:00
thorpej f2c2e160b1 Fix "print vnodes for dirty buffers" change: use vprint(); VOP_PRINT()
is only meant to be used by vprint(), and vprint() provides more
information about the vnode.
1999-08-19 18:09:44 +00:00
simonb c620766979 In vfs_shutdown() print any vnodes for busy buffers if DEBUG is defined.
Patch from Bill Studenmund.
1999-08-19 13:54:06 +00:00
ross 2f76dd5371 In getnewvnode(), initialize v_interlock when the vnode comes from the
pool allocator.
1999-08-14 06:23:59 +00:00
sommerfeld 3267e5e87d Probable fix for PR7943: lookups fail spuriously over NFS.
The problem was due to an interaction between the doomed unmounts done by
amd and getnewvnode.
I convinced myself that it's ok for getnewvnode() to do a sleeping vfs_busy().

Tested with multiple builds running while another process attempted to unmount
/usr once a second.
1999-07-29 13:31:45 +00:00
wrstuden a0f2937049 Define VLAYER and make layered fs's set this flag when creating their vnodes.
getnewvnode now checks this bit, and it if's set makes sure a vnode's not
locked before removing it from the free list.

Closes PR 7954 by Alan Barrett <apb@iafrica.com>.
1999-07-15 21:30:31 +00:00
wrstuden 379a26972f Modify file systems to deal with struct lock in struct vnode. All leaf
fs's other than nfs use genfs_lock() for locking.

Modify lookup routines to set PDIRUNLOCK when they unlock the parrent.
1999-07-08 01:05:58 +00:00
sommerfeld e303e2ee8b Fix kern/7906: race between unmount and getnewvnode()
mp->mnt_flags & MNT_MWAIT is replaced by mp->mnt_wcnt, and a new mount
flag MNT_GONE is created (reusing the same bit).

In insmntque(), add DIAGNOSTIC check to fail if the filesystem vnode
is being moved to is in the process of being unmounted.

getnewvnode() now protects the list of vnodes active on mp with
vfs_busy()/vfs_unbusy().

To avoid generating spurious errors during a doomed unmount, change
the "wait for unmount to finish" protocol between dounmount() and
vfs_busy().  In vfs_busy(), instead of only sleeping once, sleep until
either MNT_UNMOUNT is clear or MNT_GONE is set; also, maintain a count
of waiters in mp->mnt_wcnt so that dounmount() knows when it's safe to
free mp.

tested by running a "while :; do mount /d1; umount -f /d1; done" loop
against multiple find(1) processes.
1999-07-04 16:20:12 +00:00
mrg 48c12bfeed revert previous. oops. 1999-04-21 02:37:07 +00:00
mrg 58540a2274 properly test the msgsz as "msgsz - len". from PR#7386 1999-04-21 02:31:49 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
sommerfe 36dc99adac vinvalbuf, called from vclean, could cause a locking-against-self
deadlock in VOP_FSYNC() if the unreferenced vnode picked for
reclamation happened to be stacked on top of a vnode the process
already had locked.  This could happen if the same filesystem was
accessed both through a union mount and directly; it seemed to happen
most frequently when the direct access was through NFS.

Avoid this deadlock by changing vinvalbuf to pass a new FSYNC_RECLAIM
flag bit to VOP_FSYNC() to indicate that a reclaim is in progress and
only a `shallow' fsync is necessary.

Do nothing in *_fsync() in umapfs, nullfs, and unionfs when
FSYNC_RECLAIM is set; the underlying vnodes will shortly be released
in *_reclaim and may be reclaimed (and fsync'ed) later.
1999-03-22 17:24:19 +00:00
wrstuden d0ab43c887 Oops. Need to have VOP_LOCK before calling uvm_vnp_terminate, not after
(comments and code inspection in uvm_vnp_terminate agree on this).
1999-02-09 01:57:05 +00:00
christos bee9dafdf5 defopt COMPAT_43 1998-12-10 15:07:01 +00:00
thorpej eb8f1afb3e Implement vdevgone(), to revoke all vnodes corresponding to the specified
type, major, (low minor...high minor).
1998-11-18 20:24:59 +00:00
thorpej 88bc4b9f8d Conditionally include the 4.4BSD-Lite2 compat vfs sysctl code. 1998-11-15 18:38:11 +00:00
thorpej d23593a784 Make vfs_sysctl() work. 1998-11-13 20:15:32 +00:00
thorpej 830ea34819 Use the pool allocator and "nointr" pool page allocator for vnodes. The
only benefit this provides is that we don't use kmem_map to map the memory
used for vnodes (though, this is a 30 virtual page savings on my PPro)
since vnodes are never freed (they have their own freelist).
1998-09-01 03:09:14 +00:00
thorpej e00e495827 Add missing simple_unlock(), from Stefan Grefen, PR #5981. 1998-08-17 17:29:20 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
perry 730baa7431 fix sizeofs so they comply with the KNF style guide. yes, it is pedantic. 1998-07-31 22:50:48 +00:00
kleink 636443752e Nuke a couple of non-local prototypes which are already declared in either
<sys/buf.h>, <sys/mount.h> or <sys/vnode.h>.
1998-06-08 15:52:07 +00:00
kleink 382743ada3 Convert fsync vnode operator implementations and usage from the old `waitfor'
argument and MNT_WAIT/MNT_NOWAIT to `flags' and FSYNC_WAIT.
1998-06-05 19:53:00 +00:00
pk d0e85dde99 Inline vref/vrele in vclean() because:
* we already have the vnode interlock, so vref() should not ask for it again.
* we call VOP_RECLAIM/VOP_INACTIVE(), which shouldn't be duplicated in vrele().
1998-05-18 14:59:49 +00:00
pk addb5d9572 VOP_CLOSE() takes F* flags, not IO_* flags. 1998-05-08 21:02:35 +00:00
thorpej 7a239c12c6 In vfs_unmountall(), if curproc is NULL, abort, because unmounting
puts the requesting process to sleep until the file systems buffers
have flushed, and sleeping with a NULL curproc will cause a fault.
1998-04-26 19:10:33 +00:00
thorpej cbc64bb02d Make vfs_shutdown() look a little nicer. 1998-04-26 18:58:54 +00:00
fvdl 1d02bb10d8 Clarify vget() comment a bit. 1998-03-04 09:13:48 +00:00
thorpej 9ebbb62608 Export spechash_slock; it's used outside of vfs_subr.c 1998-03-03 02:22:00 +00:00
ross 94ae870894 Compile post-lite2 with #ifndef DIAGNOSTIC 1998-03-01 09:51:29 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
thorpej d1f0dbf1b1 Don't use vfssw[], it's gone; use vfs_list instead.
Implement vfs_attach() and vfs_detach(), which add and remove file systems
from the kernel.
1998-02-18 07:16:41 +00:00