Commit Graph

496 Commits

Author SHA1 Message Date
pooka 349f1154dd Don't return EWOULDBLOCK in case we have delivered some requests
even if we are operating on a nonblocking descriptor.
2006-12-10 23:53:51 +00:00
pooka 411590432c * free puffs_instance structure in all cases when closing the descriptor
* comment, rcsid & kassert police
2006-12-10 23:43:55 +00:00
pooka 5d1ddd3277 PCATCH in tsleep while waiting for operations in getop. Otherwise
we could end up in an unkillable deadlock if GETOP was called when
an operation that had locked the root vnode was already in userspace.
2006-12-10 22:37:04 +00:00
pooka 84295069e0 Fix a race condition that would cause the mountpoint to be cleaned
from under someone waiting for the fs server response in puffs_unmount()
if the descriptor was closed during the response wait (such as bug
leading to a crash in fs implementation unmount()).
2006-12-10 22:33:31 +00:00
chs c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
enami 7edaf87909 The function wget() is always responsible to maintain length of component
not yet compared.  Otherwise pathname lookup fails on certain condition.
2006-12-08 22:04:56 +00:00
pooka 2911d34706 In case of an error, return an error. Otherwise the worst case was
that dostatvfs() wrote to a recently deceased struct mount.
2006-12-07 22:06:02 +00:00
pooka 251d9ef9df let implementation ultimately decide if mmap is supported - pass
VOP_MMAP to fs server
2006-12-07 16:58:39 +00:00
pooka 997d4f41fa shuffle functions around a bit: move the transport (/dev/puffs) to
a different file from the messaging (request contents).  no functional
change
2006-12-05 23:41:24 +00:00
pooka a966070d38 adjust file size in write only if file grows. but since this change is
in the "never use ubc" branch, I don't think it matters except for cosmetics.
2006-12-05 23:07:42 +00:00
pooka 0435bcee31 Allow multiple requests to be transferred in each GET/PUTOP. For
a single request, the performance is still the same.
2006-12-05 23:03:28 +00:00
pooka ca5da47950 prefix kernel flags with PUFFS_KFLAG to have a separate namespace
from the library flags
2006-12-01 12:48:31 +00:00
pooka 74baaf5c7d don't call the fs server for all operations, only those it has told
us that it implements
2006-12-01 12:37:41 +00:00
christos 8c4a6d7ec4 PR/35151: Christian Groessler: file size reported incorrectly for files > 2GB
on a FAT32 file system on a 64bit host
2006-11-30 15:59:23 +00:00
pooka 898c6532b4 don't allow mmap if operating uncached 2006-11-28 13:20:03 +00:00
christos 9f1ff68ee1 fix missing initializer 2006-11-25 17:43:58 +00:00
scw 4f0ca2726e Support FAT filesystems on non-DEV_BSIZE media.
Based on the patches provided in PR kern/17398 by Trevin Beattie.
2006-11-25 12:17:30 +00:00
pooka 99eb16cb3c if we are going to bail due to the mountpoint being gone from under
us while waiting for syncer lock, release the newly acquired syncer
lock prior to bailing
2006-11-21 01:53:33 +00:00
pooka 65cab72c29 cosmetics 2006-11-21 01:51:42 +00:00
pooka c3f1058e4f Actually, for NOCACHE, use direct read/write instead of going through
page cache at all and invalidating.  XXX: mmap
2006-11-18 22:45:39 +00:00
pooka e1444e745f Always override f_iosize from stat() to DEV_BSIZE for now. Places such
as vnd use the information, so until "dealing with it" is defined, it's
overriden by the kernel.
2006-11-18 19:46:32 +00:00
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