Commit Graph

657 Commits

Author SHA1 Message Date
jdolecek b1126ead62 fix process used for /proc/<pid>/stat contents - it should be process
<pid>, not the current process looking at the information
2004-08-21 15:59:32 +00:00
mycroft 98a431ae8a Clean up reader/writer counts for the revoke case in fifo_close(). 2004-07-17 20:53:01 +00:00
hannken f59f039ea5 Keep a pointer to the leaf mount. Needed for write gating where a
file system gets suspended and has layered mounts above it.

Welcome to 2.0G

Reviewed by: Bill Studenmund <wrstuden@netbsd.org>
2004-07-01 10:03:29 +00:00
hannken 7ca8e916c9 Do LAYERFS_REMOVED for vop_rmdir.
Reviewed by: Bill Studenmund <wrstuden@netbsd.org>
2004-06-30 17:42:55 +00:00
yamt 9ba27abaf6 layer_islocked: check a status of the lower vnode as well. 2004-06-19 06:17:15 +00:00
wrstuden fc40e52454 Change fifo_{un,}lock and fifo_islocked to use the "real" lock
ops, not the nolock variants. Should have no real impact as according
to mkid, we only use fifo_vnodeop_entries, via fifo_vnodeop_p,
for selective operations on fifos. All the fifo users use the native
file system's locking routines.

Removes one use of genfs_nolock and friends.
2004-06-16 19:22:26 +00:00
wrstuden 9cbb082fac Make sure we actually locked the parent vnode before we clear
PDIRUNLOCK. The whole reason we have the flag is to note (rare)
cases where we are supposed to have the parent directory locked
but don't. Permits error handling code to know what to do with
the parrent vnode (vrele() vs vput()).
2004-06-16 17:59:53 +00:00
yamt 0061167644 - eliminate gratuitous differences between umap_bypass() and layer_bypass().
- fix a typo in a comment.
no functional changes are intended.
2004-06-16 12:39:07 +00:00
yamt 2fa619c249 missing error recover from layer_node_create failure. 2004-06-16 12:37:01 +00:00
yamt c9817d1a97 umap_lookup/layer_lookup: NULL out *ap->a_vpp after calling
underlying filesystem because some caller including lookup()
assume that *vpp is NULL on error.
2004-06-11 12:34:13 +00:00
yamt 656e74e298 do a LAYERFS_REMOVED hack for vop_rename as well. 2004-06-07 17:36:38 +00:00
wrstuden 67a15e9a78 Add layerfs_snapshot() as a handler routine for VFS_SNAPSHOT() calls
through a layered file system.

Note: we don't actually support snapshots through a layered file system,
and this routine returns an error. However we: 1) have clearly documented
what needs fixing (which isn't trivial to fix) and 2) if we do fix
this, all layered file systems can take advantage of it at once.
2004-05-29 23:48:08 +00:00
tron 1db853aa0f Don't leak memory in VFS_MOUNT() if set_statvfs_info() fails. 2004-05-29 14:28:41 +00:00
wrstuden 6753c74560 Since VOP_UPCALL() has been a long time in coming, add this partial
fix for layered-file-removal. It will work for the case of accessing
and deleting a file through the layered file system. Accessing via
the layer and deleting on the underlying still won't work, nor will
accessing via complicated structures (like two umap layers over a
given file systems).

We still need VOP_UPCALL(), but this is better than things were before.

This patch has been discussed off & on for a while. This incarnation
was tested by hannken at netbsd dot org.
2004-05-28 18:55:20 +00:00
yamt ffa2240d3b - remove a comment which is no longer true.
- add "XXX vn_lock" comments where we can call VOP_READ/WRITE
  without vnode lock held. (genfs_compat_*)
2004-05-27 12:53:25 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 53c625655c Sysctl descriptions under vfs subtree 2004-05-25 04:44:43 +00:00
christos 42a255dd25 Unfortunately, we need to allocate space here. Pointed out by Juan RP. 2004-05-22 23:17:04 +00:00
jonathan 230fb9b8ab Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded  by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize.   Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
2004-05-22 22:52:13 +00:00
christos a441628d4c we are copying all the infomation from statvfs here; we don't need an
intermediate copy on the stack.
2004-05-22 20:28:38 +00:00
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +00:00
christos 999e9cef64 Simplify the code by:
1. Checking for a negative uio_offset at the beginning. This really does
   not affect us in most cases because we check that later too.
2. Checking for attempts to write to init sooner and in all cases.
2004-05-14 16:35:24 +00:00
cl 719c5983ec Workaround for gcc 2.95.3 failing to initialize structures
and/or unions inside structures using nested designators.
Should be reverted when gcc >=3.3.3 is ready for vax.
2004-05-13 15:44:04 +00:00
jrf 5f626331c1 caddr_t -> void * and removal of some more casts. 2004-05-12 02:07:37 +00:00
cl 65569a4d16 Allow additional entries (files, subdirs) in kernfs. Also allow
defining additional kfstypes and provide hooks to run arbitrary code
for any vnodeop on the additional types.
2004-05-07 15:33:17 +00:00
cl a2a2784bfd remove code no longer needed since the type/permission information
is available in the entry's struct kern_target and every entry has a
(possibly shared) struct kern_target now.
2004-05-07 15:20:29 +00:00
cl 81d3c2061c Make lookup and readdir return the same inode number. kernfs_readdir
now uses kernfs_allocvp to map from kernfs entry to inode number,
kernfs_allocvp is now the only place where entries are mapped to inode
numbers.  Also make KERNFS_FILENO not return random results for entries
not in kern_targets.
2004-05-07 15:06:15 +00:00
cl 5f113f8e16 Find the right entry when doing lookup on dotdot in kern/ipsec subdirs.
Also remove some duplicate code.
2004-05-07 14:56:48 +00:00
jrf bafcaa70cd Removed remaining caddr_t casts we do not need in miscfs. Recompiled
kernel and ran for a day or so. There are still some caddr_t types in
the arguments of some calls, I will do those separately (later) as
they touch a lot more of the system.
Approved by christos@NetBSD.org.
2004-04-29 16:10:54 +00:00
jrf fc97fd571a First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

	- removed casts from unionfs, deadfs and fdesc
	  (there are more to hunt down still)
	- changed vfs_quotactl args argumet from caddr_t to void *
	- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
2004-04-27 17:37:30 +00:00
itojun 8bcb745d7c sprintf -> snprintf 2004-04-22 00:31:00 +00:00
christos 90345b38a6 add sys/dirent.h 2004-04-21 02:40:42 +00:00
christos 4bdb80839b add sys/dirent.h 2004-04-21 02:38:16 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
atatat f0e2808b8b Remove pointless comment about layerfs_sysctl() 2004-03-09 03:16:08 +00:00
wrstuden 8383006f0f Handle the case of fifo_close() getting called from vclean(). In that
case, we tear down the node-specific storage as if there were no more open
users. As vclean() will VT_NON the vnode before anyone else will get access
to the vnode, this is our last chance.

Fixes memory leak in revoke(2) path noticed by tedu at openbsd dot org.
2004-03-06 00:38:29 +00:00
jdolecek cb3ab0a872 unlock the descriptor table simple lock after fd_getfile() call in
procfs_readdir()
fixes procfs locking problems reported on current-users@, problem place
found by enami tsugutomo
2004-02-15 22:18:17 +00:00
hannken 142e9d5deb Add a generic copy-on-write hook to add/remove functions that will be
called with every buffer written through spec_strategy().

Used by fss(4). Future file-system-internal snapshots will need them too.

Welcome to 1.6ZK

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-02-14 00:00:56 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
atatat d0a69862ef Rename sysctl setup function to match "reality" 2004-01-17 03:37:42 +00:00
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +00:00
drochner a33b8b088c a little bit more namespace sanity 2003-12-10 14:19:02 +00:00
hannken fbae381aaa The file system snapshot pseudo driver.
Uses a hook in spec_strategy() to save data written from a mounted
file system to its block device and a hook in dounmount().

Not enabled by default in any kernel config.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-12-10 11:40:11 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
wiz 03e41d98b7 Typo fixes in comments from jmc@openbsd. 2003-11-30 20:53:48 +00:00
matt 7bf0959ab7 Restore a change that made AF_LOCAL sockets block on connect(2) until
accepted.  However, this time this behavor is not the default.  Instead
it must enabled by using the LOCAL_CONNWAIT socket option on either the
connecting or accepting socket.
2003-11-29 10:02:42 +00:00
perry 6032efb56d Revert a change that altered the semantics of AF_LOCAL sockets. Sadly
this made us API incompatible with other Unixes.
2003-11-29 06:08:29 +00:00
pk 9ed750b8fe genfs_revoke: use ltsleep() to release the vnode spin lock to avoid a
sleep/wakeup race.
2003-11-27 07:58:02 +00:00