Commit Graph

377 Commits

Author SHA1 Message Date
thorpej b94e29816f MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-03 03:39:52 +00:00
jdolecek b0fb24279c change the lf_advlock() arguments from
int     lf_advlock __P((struct lockf **,
           off_t, caddr_t, int, struct flock *, int));
to

int     lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).
2000-07-22 15:26:11 +00:00
thorpej b221909e32 Sprinkle some const. 2000-07-14 07:21:50 +00:00
mycroft caf07dfa04 When unmounting, make sure to free the syncer vnode so that it can be reused. 2000-07-09 00:59:03 +00:00
mrg 20515f2854 <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 02:44:06 +00:00
mrg e185413725 remove redudant <vm/pmap.h> includes. <vm/pmap.h> -> <uvm/uvm_pmap.h> 2000-06-27 04:18:48 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
mrg c543a66253 remove some redundant <vm/vm_xxx.h> includes 2000-06-25 13:26:19 +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
thorpej a804b492ac Use CMSG_*() properly. 2000-06-05 17:21:38 +00:00
simonb ab92666f6b Fix a possible kernel memory leak - if the cmdline of a process was
requested after it had started to exit but before it became a zombie
a page of kernel memory wouldn't be free'd.
2000-06-01 13:43:08 +00:00
mycroft 7385963fc9 Stylistic change. 2000-05-29 18:59:51 +00:00
thorpej 21fc65e1a8 sleep() -> tsleep() 2000-05-27 04:52:27 +00:00
simonb 0c59b3c325 Apply patch from Robert Elz in PR kern/10113. This fixes two problems
with procfs's cmdline - from the PR:

	The cmdline implementation in procfs is bogus.  It's possible that
	part of the fix is a workaround of a UVM problem - that is, when
	(internally) accessing the top of the process VM (the end of the
	args) a request for I/0 of a PAGE_SIZE'd block starting at less
	than a PAGE_SIZE from the end of the mem space returns EINVAL
	rather than the data that is available.  Whether this is a bug
	in UVM or not depends upon how it is defined to work, and I was
	unable to determine that.   (Simon Burge found that problem, and
	provided the basis of the workaround/fix).

	Then, the cmdline function is unable to read more than one
	page of args, and a good thing too, as the way it is written
	attempting to get more than that would reference into lala land.

	And, on an attempt to read a lot of data when the above is
	fixed, most of the data won't be returned, only the final block
	of any read.

Tested on alpha, pmax, i386 and sparc.
2000-05-16 13:45:25 +00:00
perseant f0728fdce1 Change the sementics of the last parameter from a boolean ("waitfor") to
a set of flags ("flags").  Two flags are defined, UPDATE_WAIT and
UPDATE_DIROP.

Under the old semantics, VOP_UPDATE would block if waitfor were set,
under the assumption that directory operations should be done
synchronously.  At least LFS and FFS+softdep do not make this
assumption; FFS+softdep got around the problem by enclosing all relevant
calls to VOP_UPDATE in a "if(!DOINGSOFTDEP(vp))", while LFS simply
ignored waitfor, one of the reasons why NFS-serving an LFS filesystem
did not work properly.

Under the new semantics, the UPDATE_DIROP flag is a hint to the
fs-specific update routine that the call comes from a dirop routine, and
should be wait for, or not, accordingly.

Closes PR#8996.
2000-05-13 23:43:06 +00:00
augustss bd842961d4 Register, begone! 2000-03-30 12:22:12 +00:00
simonb 45171aaef9 Delete redundant decls of vn_syncer_add_to_worklist(), syncdelay,
filedelay, dirdelay and metadelay - they're in <sys/vnode.h>.
2000-03-30 02:21:49 +00:00
simonb 92701d715c Delete duplicate declaration of atopid(). 2000-03-30 02:20:14 +00:00
simonb 08312317e7 Delete redundant decl of layer_node_create(), it's in layer_extern.h. 2000-03-30 02:19:16 +00:00
simonb 0177c68ba1 Delete redundant decl of fdesc_root, it's in fdesc.h. 2000-03-30 02:16:22 +00:00
jdolecek 88b591be30 Adapt to last VFS changes - add appropriate vfs_done routine. 2000-03-16 19:00:26 +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
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
fvdl bb4e324508 Fix pasto: some lines of the procfs hash code were copied from the
UFS code, and I forgot to rename the "ihash" variable, causing
weird effects, because 3/4th of the UFS hash table would become
unreachable after procfs was loaded as an LKM.
2000-02-25 22:33:43 +00:00
fvdl 15bb1bd145 At mount/unmount time, add an exec hook to revoke all vnodes iff the
process is about to exec a sugid binary.

To speed up things, use hashing for vnode allocation, like other filesystems
do. This avoids walking the whole procfs node list in the revoke case too.
2000-01-25 21:52:04 +00:00
wrstuden fab192f2d2 Add overlay, a layered file system which overlays itself on
the underlying fs, rather than exporting it to another part of the
directory name space.
2000-01-20 19:06:13 +00:00
sommerfeld 530432986b Actually nullop is a better idea here 1999-12-12 00:56:29 +00:00
sommerfeld c7ed8ada64 one more tweak: placebo for VOP_LEASE 1999-12-08 20:05:19 +00:00
sommerfeld a51f685d41 Add appropriate VOP_FCNTL handlers to deadfs and specfs ops vectors. 1999-12-08 19:16:51 +00:00
sommerfeld f0cc7a5815 Change to comment (only) indicating what the specfs ops vector is used for. 1999-12-08 18:57:07 +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
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
wrstuden 092a6ee985 Since we don't put layered device nodes in the spechash hash chains,
initialize vp->v_hashchain to NULL.
1999-10-25 23:34:31 +00:00
fvdl d369311766 Remove some mentioned members in the vop {un}lock args struct that we
do not actually have.
1999-10-23 19:34:50 +00:00
wrstuden e682a080e9 In spec_close(), if we're not doing a non-blocking close and VXLOCK is
not set, unlock the vnode before calling the device's close routine and
relock it after it returns. tty close routines will sleep waiting for
buffers to drain, which won't happen often times as the other side needs
to grab the vnode lock first.

Make all unmount routines lock the device vnode before calling VOP_CLOSE().
1999-10-16 23:53:26 +00:00
thorpej 8772062270 Make /proc/self a symlink to /proc/curproc. I've observed Linux programs
that expect /proc/self/cmdline to exist.
1999-09-02 23:33:45 +00:00
sommerfeld 197579af47 Change variable used for directory offset from "int" to "off_t".
Overkill, but avoids a host of truncation problems.
1999-08-25 14:42:35 +00:00
sommerfeld 2e649e46d3 Fix PR8270:
Problem turned out to be due to improper handling of reads beyond EOF:
they should just return without error with the uio unchanged, and the
caller will recognize this as a zero-byte return (EOF).

The previous fix to protect directory reads against bogus uio_offset
values returned EINVAL, which broke mount -o union, which only
union'ed in the lower directory if the upper directory cleanly
returned EOF.

While we're here, protect kernfs as well.
1999-08-24 23:29:08 +00:00
wrstuden e4a256cf0c Fin uninitialized variable use noted by Simon Burge. 1999-08-16 21:24:53 +00:00
christos 582a6def8b protect against large uio_offset 1999-08-14 02:20:19 +00:00
christos 063e3b9f0f protect against large uio_offsets 1999-08-14 02:17:17 +00:00
wrstuden 3bf14d81e9 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
1999-08-03 20:19:16 +00:00
sommerfeld d96e35f23c Fix PR4439: directory link count in unions where only upper directory
exists is bogus.  The goal here is to produce a synthetic link count
which won't confuse fts and similar routines which "know" that
directories with a link count of 2 don't have subdirectories (and
thus, they can avoid having to stat every entry in the directory
looking for subdirectories which aren't there).

We know that non-UNIX filesystem implementations may return a link
count of `1' for directories with an indeterminate number of
subdirectories; if either the upper or lower layer returns a link
count of `1', return a link count of 1.  If both layers return a link
count of 2, return a link count of 2; otherwise, return the sum of the
link count of both layers.

Also, fix PR7430: unionfs ignores read-only mounts.  Check for
MNT_RDONLY in union_lookup (more-or-less as in layer_lookup) as well
as union_access() and union_setattr().

Note that a read-only union layer may still cause side effects on the
underlying filesystems...  Most notably, we'll still attempt to create
shadow directories in the upper layer.  Also, of course, we'll
side-effect atimes in the lower layer.
1999-08-01 23:16:34 +00:00
sommerfeld cb448a064d Fix PR5146: reboot with working directory in unionfs causes
"panic: lockmgr: using decommisioned lock"
(only if DIAGNOSTIC)

The problem turned out to be due to the way LK_DRAIN was (not) handled
in union_lock; it just got passed through to the lock on the upper
vnode (which got marked as decommissioned, instead of that happening
to the union vnode.  When the upper vnode was next locked (typically
when it was released), it went kaboom.
1999-08-01 00:00:57 +00:00
sommerfeld 29469abdbd On forced unmount, do a few passes of non-forced cleanups and then do
a single forced pass.  Along for the ride with PR5146 fix.
1999-07-31 23:56:15 +00:00
thorpej fc04cf9982 Add calls to lock the proclist as appropriate. 1999-07-25 18:33:47 +00:00
thorpej 2715b812d1 Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe.  A new process state is added: SDEAD.  This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path).  When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
1999-07-22 18:13:36 +00:00
thorpej 7f53187a85 From Bill Studenmund: unlock the fdescfs "/dev/tty" vnode before calling
cttyread()/cttywrite(), and lock it again when it returns.

Squashes the somewhat bizarre lossage I was observing w/ more(1), sudo(1),
etc.
1999-07-19 23:00:47 +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
thorpej f9b0db3013 Fix a paste-o in procfs_lookup() introduced with the vnode locking changes.
Fixes PR #7961, Mario Kemper <magick@bundy.lip.owl.de>.
1999-07-14 23:52:22 +00:00