Commit Graph

475 Commits

Author SHA1 Message Date
pooka
a1485f3144 make puffs_strategy more robust 2006-11-18 19:33:02 +00:00
pooka
61a717befb prevent value 0 for mnt_stat.f_iosize, it is sometimes used as a divider 2006-11-18 12:50:59 +00:00
pooka
0eca4b2eaa Require statvfs info from startreq so that we have that info available.
Also, don't pass fsid to userspace and just fill it in the kernel.
2006-11-18 12:39:48 +00:00
pooka
dfa114e254 As a first generation best-effort hack, use NOCACHE to mean "file
size can change without the kernel knowing" and therefore query
the file size before invoking read or write operations.
2006-11-18 08:18:24 +00:00
pooka
e5e4a4f6bc Introduce uncached operation, makes sense when the file system backend
can be modified from elsewhere than the file system interface
2006-11-17 17:48:02 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
pooka
2293b63a7e Fix a race condition with unmount where the mountpoint might disappear
from under us while waiting for syncer_lock and before we got to vfs_busy.
This happens easily e.g. when the userspace server loses its will to
live in VOP_RECLAIM, which is called from vflush() in VFS_UNMOUNT.  We
get two competing unmounters.  When the first one finishes, it releases
syncer_lock.  Now the second one tries to vfs_busy(), but is greeted
with garbage in *mp.

XXX: Technically this is a more general issue and should be fixed
elsewhere, but it's hard to trigger it with normal file systems
unless they are unmounted "simultaneously" twice and are dirty
enough for flushing to take a while.  So make a note about it in
the little black book next to the poems and postpone the crusade
for now.
2006-11-14 19:36:50 +00:00
pooka
93a5732221 No need to return a special value for CREATE/RENAME lookup, so just
handle ENOENT.  If there's a real error, userspace will return
something else.
2006-11-13 20:57:56 +00:00
jmmv
52b7ca57d3 Fix typo in comment. 2006-11-13 11:47:37 +00:00
jmmv
cff91bd8fc Add 2006 to the copyright notice; should have done this when touching the
files before.
2006-11-09 16:20:06 +00:00
jmmv
ccb670c8b8 Opening a file after it has been removed (e.g. rmdir $(pwd)) has to fail. 2006-11-09 15:36:30 +00:00
jmmv
117b5f5104 Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.
2006-11-09 15:06:03 +00:00
pooka
098590e87e few renames to better differentiate between mount & start.. plus some
other renaming
2006-11-09 13:09:34 +00:00
pooka
7288f6ba9f update struct buf resid in strategy according to what was transferred.
seems like only nestiobuf complains when it wasn't updated ...
2006-11-08 11:49:36 +00:00
pooka
b3bdf665dd attach to genfs & support page cache. most noticeable effect is
mmap and therefore execution of binaries starting to work, some
speed improvements with large file I/O also.  caching semantics
and error case handling most likely need revisiting.
2006-11-07 22:10:18 +00:00
jmmv
749d415179 tmpfs_open cannot assume that the node to be open is still linked to a
directory, so remove an invalid assertion.  Otherwise the kernel incorrectly
panics when accessing the current directory after it has been removed.
2006-11-07 14:08:13 +00:00
pooka
c15972c2b3 puffs_park always contains a specific puffs_req, so make it a member
instead of a pointer
2006-11-06 23:18:18 +00:00
pooka
f212146148 make it possible to build & load puffs as an LKM
by Lubomir Kundrak, PR kern/35000
2006-11-06 11:44:54 +00:00
jmmv
042827a010 Randomly initialize the node's generation to make file handles less
predictable.  This solves a problem that may appear when serving a tmpfs
over NFS: if the server reboots, newly allocated files should have
different file handles; otherwise the remote clients could access files
they were not supposed to touch.
2006-11-05 19:40:31 +00:00
jmmv
1a3e8c3caa Protect the dircookie stuff with _KERNEL. Fixes build problems of
mount_tmpfs as reported by Hisashi T Fujinaka in private mail.
2006-11-05 19:36:07 +00:00
jmmv
2a3293d093 Exporting tmpfs file systems through NFS now works. Sure, file handles are
not persistent across reboots but neither are those of MFS, which we are
trying to replace.  We should probably warn the user somehow, but not
prevent him doing this if he really wants to.

While here add a "reply" to the code-style change item.
2006-11-05 18:03:21 +00:00
jmmv
b2603104c2 Truncate directory cookies to 31 bits to avoid problems exposed in Linux
binaries which cast the returned values to 64-bits and fail due to sign
expansion.  More details are provided in the big comment in tmpfs.h that
describes how the new tmpfs_dircookie works.

This is a rather ugly hack that shall be fixed with a cleaner solution,
but this resolves the problem in an effective way.

Fixes kern PR/32034.
2006-11-05 16:59:18 +00:00
jdolecek
d5f5129729 add one code style and one knote-related item 2006-11-05 09:40:26 +00:00
jmmv
e0fd5659c6 Bring in fix from FreeBSD by tjr, 3 years and 9 months ago: Store a
reference to the parent directory's vnode instead of its smbnode to
avoid a use-after-free bug causing a panic when a smbfs mount is
forcefully unmounted.

Keep trying to flush the vnode list for the mount while some are still
busy and we are making progress towards making them not busy.  This
stops attempts to unmount idle smbfs mounts failing with EBUSY.

The easiest way to reproduce the above problem, from what I have seen is:
1) Assume /s is a smbfs mount point.
2) mount /s
3) stat /s/foo/1
4) umount /s
   Returns error because the file system is busy.
5) Shutdown the machine: panic in smbfs_reclaim because vrele
   accesses already-released memory.
2006-11-02 17:34:21 +00:00
jmmv
51634dfd25 Make tmpfs_getpages behave as genfs_getpages by ignoring the input pages
array's contents and returning all the requested pages.  Otherwise there
are problems (accessing invalid memory) when the a_m vector is passed
uninitialized as the NFS server code does.  Fixes PR kern/34959.

Note that this is not a "real" fix.  While this makes tmpfs's getpages
operation consistent with the behavior of other file systems, it does
not resolve the different semantics between uvn_get and uao_get as
described in PR kern/32166.  I'm adding a comment in the code mentioning
exactly this so that it can be reviewed when this last problem is
addressed.
2006-11-02 15:35:25 +00:00
jmmv
71f9a07732 Update the file's ctime after a rename. Thanks to pooka@. 2006-10-30 15:23:20 +00:00
jmmv
da1dae4180 Grr... cvs diff scrolled too much and I didn't notice there were some
unwanted changes in this file.  Revert them; sorry.
2006-10-30 15:11:01 +00:00
jmmv
2185c98874 When renaming a file, we have to modify the mtime of the directory holding
it, not the mtime of the file itself.  This fixes the problems exposed when
unpacking software under a tmpfs and trying to build it because dependencies
were not calculated properly (e.g. autoconf 2.60 as reported by tls@).
2006-10-30 15:09:47 +00:00
pooka
eb6da7fc35 fix checkalias true branch: don't unlock or lock twice 2006-10-27 19:54:34 +00:00
pooka
0035113cf8 Use spec_fsync for specops vop_fsync: it knows about vflushbuf(), which
is more than what puffs currently knows.  makes e.g. ffs unmount for a
puffs-based device node work.
2006-10-27 19:01:48 +00:00
pooka
30a851c1d1 support fifos 2006-10-27 12:25:16 +00:00
pooka
0f94cb76f7 support specfs 2006-10-26 22:52:47 +00:00
pooka
93c897b7ab Fix operations creating new nodes to honor the vnode locking protocol
if the userspace server returns an error.  Fixes lockups if any
of the following operations failed: create, mknod, mkdir, symlink
2006-10-26 13:42:21 +00:00
pooka
f15702aabc debug print fixes 2006-10-26 13:35:23 +00:00
reinoud
dc5b5420b9 Revisit mnt_vnodelist TAILQ patch. Remove all suspicious TAILQ_FOREACH()
loops where vnodes can get removed or added during the loops. This could
lead to panic's on unmount since nodes are skipped or otherwise
TAILQ_NEXT(0xdeadbeef, ...) was dereferenced.
2006-10-25 22:01:54 +00:00
pooka
14d708398a pass VOP_INACTIVE() to userspace 2006-10-25 18:15:39 +00:00
pooka
a72d8a71e5 If the control descriptor is closed, mark userspace dead and wakeup
all waiters *before* trying to get the syncer lock necessary for
dounmount().  This prevents a deadlock if the userspace server dies
while the syncer is running.
2006-10-25 12:04:14 +00:00
drochner
21440e4fda minor fix to error handling (from OpenBSD, rev.1.40):
only set devvp->v_specmountpoint on successful mounts
2006-10-24 19:59:52 +00:00
pooka
4f1cd3b286 Apply a little eggwash to a deadlock condition where calling
getnewvnode() while holding on to any vnode lock deadlocks the
system if the file system is being forcibly unmounted.

Normal file systems don't trigger this problem because of two reaons:
1) they don't hold on to vnode locks while idling who-knows-where, so
   the race doesn't trigger
2) they aren't usually unmounted with FORCE; puffs is, in case "someone"
   manages to make a crashy userspace server

Nevertheless, a real solution is slowly being braised.
2006-10-23 23:32:57 +00:00
pooka
6ea08fd809 bump the reqstruct minsize to something more believable (but I should
really fix this, still)
2006-10-23 16:07:18 +00:00
pooka
e4ae558e9d fix print in VOP_PRINT
also make it compile on amd64.  problem noticed by Blair Sadewitz
on current-users
2006-10-23 12:21:39 +00:00
pooka
8640fbb580 kernel portion of puffs - the Pass-to-Userspace Framework File System.
It contains the VFS attachment and userspace message-passing interface.

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks.  While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace.  Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
2006-10-22 22:43:23 +00:00
reinoud
d31cd7fc58 Add extended attribute numbers associated with the two defined structures
for times and device specification.
2006-10-22 00:06:48 +00:00
reinoud
9c8aedbe6c Return the TAILQ_FOREACH to an explicit `for' loop since in the loop vnodes
can be removed.
2006-10-22 00:03:33 +00:00
reinoud
0ce809091d Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
2006-10-20 18:58:12 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
chs
7ddbeb08d1 move includes only needed for kernel inside ifdef _KERNEL. 2006-10-06 02:40:58 +00:00
reinoud
14573dd3a8 Fix panic on unmounting VAT file systems. The VAT table was allocated and
freed on the wrong malloc type.
2006-10-04 13:03:17 +00:00
reinoud
21d692155a Fix memory leaks on mounting and dismounting UDF volumes. 2006-10-03 15:54:03 +00:00
christos
804dfaa036 Coverity CID 2960: Don't print NULL vnode (from Arnaud Lacombe) 2006-09-29 19:41:16 +00:00