Commit Graph

957 Commits

Author SHA1 Message Date
pooka 41df8e0fed Reorganize how the root vnode is fetched so that it doesn't always
go through VFS_ROOT() and allow to fetch it without locking it.
This allows us to call the cache flush operations also for the root
vnode and most notably fixes e.g. a "No such file or directory"
for a psshfs root directory ls -l when a file was locally deleted
and remotely re-created.

Also fix some sloppy programming in root node fetch (mostly cosmetic).
2007-06-21 14:11:34 +00:00
pooka f8326bf98e Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
2007-06-06 01:54:59 +00:00
pooka e2819ad1be In very verbose debug mode, print also return values for operations
(well, at least for those that go through checkop()).
2007-06-06 01:33:10 +00:00
yamt da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
yamt 7e6f80a234 \xa0 -> space. 2007-06-01 15:59:37 +00:00
pooka 68568e7a22 forgot to commit this with puffs_vnops.c 1.72:
Actually, we do need separate "no references in file server" and
"noref + inactive" flags if we wish to correctly support unix open
file semantics and optimize away pre-reclaim cache flushes.  So,
add PNODE_DYING which stands for norefs + inactive.
2007-05-19 16:50:49 +00:00
pooka 121b6fb7b3 Actually, we do need separate "no references in file server" and
"noref + inactive" flags if we wish to correctly support unix open
file semantics and optimize away pre-reclaim cache flushes.  So,
add PNODE_DYING which stands for norefs + inactive.
2007-05-19 16:35:01 +00:00
pooka e99cb62bcc Introduce noref setbacks, which the file server can use to signal
the kernel it has 0 references to the node in question.  In other
words, this can be used to avoid inactive(), or, if the file server
does not implement inactive, prompt reclaim for removed nodes.
2007-05-18 15:46:09 +00:00
pooka 93dd832918 selrecord() before calling userspace to avoid (very theoretical) race
where selinfo contains uninitialized garbage
2007-05-18 14:25:30 +00:00
pooka 9d9f624f97 Support VOP_POLL. This requires some acrobatics on the puffs_node,
as we give a reference to userspace for the puffs_node for the
duration of the poll call.  So reference count puffs_node separately
from the parent vnode.  vref()/vrele() is not possible due to a possible
surprise visit from VOP_INACTIVE.
2007-05-18 13:53:08 +00:00
pooka 339652951e Make it possible for the file server to specify the root vnode type
and other information instead of always using VDIR.  To make this
possible without races, require all root node information already
in puffs_mount() and nuke puffs_start2() and the associated start
operation completely.

requested/inspired by Tobias Nygren
2007-05-17 13:59:22 +00:00
pooka d79dbd3583 In case strategy memory allocation for B_ASYNC|B_READ fails,
make sure to release the buf.
2007-05-15 12:48:48 +00:00
pooka a6b1636499 Adventures in file systems, part (u_quad_t)-1: we can't use the
file system value for the size of device special files, as that
comes from specfs instead of the "host" file system.  Therefore,
take care that getattr doesn't override the value of vp->v_size.
2007-05-08 21:39:03 +00:00
pooka 4537434d57 If the op was interrupted, decrease ops waiting for fetch from the
file server only if the op was still waiting for fetch (as opposed
to waiting for the response).  Also, properly flag the possible
following inactive as an op for which we do not want to wait for
the response from the file server.
2007-05-08 21:16:55 +00:00
pooka 151ee075e9 Introduce puffs "setbacks", which can be used to set certain flags
for nodes upon return from the userspace.  Currently it can be used
to indicate that the file server should be notified of "inactive"
in case the file server has opted to not receive inactive every
time the reference count for a vnode drops to zero.  (inactive is
a common event, almost never requires any action and must be executed
sychronously, so it is wasteful).

While doing this, cleanup the release-relock nonsense from the
vntouser*() arguments.  It was never enabled and the whole LOCKEDVP()
concept was very broken to begin with.
2007-05-07 17:14:54 +00:00
pooka b5aae3d4e3 If setattr is called explicitly, use that as the sign to flush out
all metadata info cached in the kernel while we're setattr'ing in
any case.  Solves problems such as truncate (via extend-by-write)
+ chmod resulting in EPERM because the file was already read-only
when the actual truncate was flushed out of the kernel in fsync.
2007-05-06 19:43:14 +00:00
pooka 6ffefad6ef Fix a problem introduced when I converted puffs to use newlock2:
when unmounting the file system in case of a certain timing (and
possibly some other conditions), a thread would wait on a condition
variable, while another thread broadcast the cv and immediately
proceeded to destroy it.  The result was a system frozen completely
solid shorly after the process waiting for the cv woke up.  So
introduce reference counting to synchronize destruction of the
resources in unmount.

I was able to repeat the problem only on my laptop in some special
cases, so I do not know how common it was.  Ironically, killing
the file server process violently instead of unmount() didn't have
this problem because it never entered the unmount path from two
directions.
2007-05-01 12:18:40 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
pooka b474c785b7 If ubc style write fails, do not extend the file by zero-padding
it.  It might be that the file server is either crashing or just
returning consistent errors.  uiomove() would handle the error,
but if the pages weren't faulted in, memset() to the unfaultable
ubc window would cause a kernel page fault.
2007-04-24 16:29:29 +00:00
pooka c25fa1208b remember to flag park as done when we're done with it 2007-04-24 09:44:57 +00:00
pooka 8689b1a6b2 Now that puffs_park is allocated from the heap and actually freed
by the userdead routine, don't do a TAILQ_FOREACH but rather an
honest for loop.
2007-04-22 21:52:37 +00:00
pooka 6770f9f87e Issue close to the file server asynchronously. We're not interested
in the return value.
2007-04-22 18:50:28 +00:00
pooka bc38632c58 define PUFFS_KFLAG_WTCACHE, which makes the page cache write-through 2007-04-22 18:02:05 +00:00
pooka e4526ed3a0 Take care not to access park->park_preq if the waiter is gone, as
that memory is no longer available.
2007-04-21 10:36:59 +00:00
pooka 1de42023d1 don't mutex_enter() manually, we've already park_reference()d a few
lines earlier for entering the same mutex
2007-04-20 21:35:31 +00:00
pooka ac5f1b1b78 * in readdir, don't copy extra memory back and forth to userspace
* consistent usage of the variable argsize with the rest of the module
2007-04-20 11:56:35 +00:00
pooka 07ba7a7d5f Size of a readdir cookie is sizeof(**ap->a_cookies), not
sizeof(*ap->a_cookies).  Fixes nfs readdir in the case that a
directory had lots of entries with short names.
2007-04-20 11:36:25 +00:00
yamt 337d052ee1 hold proclist_mutex when calling psignal(). 2007-04-19 11:05:14 +00:00
pooka 5880c46d2d fix comment in previous 2007-04-16 14:09:53 +00:00
pooka 947c4b9f60 Allow to set non-blocking mode for transport fd even if the file
system is not yet mounted.
2007-04-16 14:09:00 +00:00
pooka f2cea5c791 Sanity-check & possibly adjust number of hash buckets already before
returning the mount argument structure to userspace.
2007-04-16 13:54:07 +00:00
pooka 96fd5059d7 catch invalid size file handles already in the kernel 2007-04-16 13:24:35 +00:00
pooka 4ccbce8168 Give the file server the ability to specify the file handle length
instead of defining a static length file handle on the framework-level.
2007-04-16 13:03:26 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
xtraeme 8d9be19250 size_t is unsigned, so use zu rather than zd which is for ssize_t,
as Matt Thomas pointed out.
2007-04-14 16:52:22 +00:00
xtraeme 6465fceffd Use zd to printf size_t. 2007-04-14 16:13:18 +00:00
pooka 0c3748498f Allow file servers to request the number of hash cookie buckets for
pnode -> vnode reverse lookup.
2007-04-13 15:25:35 +00:00
pooka 4e4ce72bb3 * add fhlen to kernel argument structure
* rename it to puffs_kargs instead of puffs_args
2007-04-13 13:31:11 +00:00
reinoud 1adc8479ba Some rogue implementations use random physical partion numbers just to
break other implementations so lookup the physical number instead of
indexing it. Choosing random numbers here is legal according to the specs,
but not a logical choice and most likely done as a wierd kind of copy
protection.

Rogue implementation found to use this
	*Microsoft CDIMAGE UDF
2007-04-12 01:56:36 +00:00
pooka f50d2a26f2 * support VFS_FHTOVP and VFS_VPTOFH
* support cookies in for VOP_READDIR

nfs exporting puffs file systems works now
2007-04-11 21:03:05 +00:00
pooka c634885e0f make overspammy debug printf less overspammy 2007-04-11 09:43:19 +00:00
pooka bc8224a1b3 fix comment: struct fid is in fstypes.h now 2007-04-09 12:21:24 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
hannken e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
pooka 43c6ec1a06 support flushing pagecache 2007-04-06 17:48:44 +00:00
pooka 13fa815486 actually, we don't need a separate op for flushing the whole page cache
of a node, just use the range op with endoff = 0
2007-04-06 17:05:34 +00:00
pooka bd8d0a2ae0 * enable PUFFS_INVAL_PAGECACHE_NODE_RANGE
* add input parameter validation
2007-04-06 16:37:02 +00:00
pooka 3651f3e73b Fix one more bug from today's commit: don't remove the op for which
getops runs out of file server buffer space from the request queue.
Otherwise that operation silently vanishes and things go, well, quite
wrong.
2007-04-04 21:02:30 +00:00
pooka a0d5166093 fix two loop mutex botches in previous 2007-04-04 20:22:47 +00:00
pooka fa71b0706d Make it possible to interrupt waiters for fs operation completion
again.  This is useful until locking is further developed and basically
any deadlocks can be solved by killing appropriate processes.

Thanks especially to Tommi Kyntola and Antti Louko for sitting down
with me and discussing resource ownership and locking strategies
in implementing this.
2007-04-04 16:13:51 +00:00
pooka ad018126a3 s/ppark/park/ to make all the variable names consistent - park is
always a pointer now.  no functional change
2007-04-04 15:50:56 +00:00
rmind 523c1fc3e1 filecore_mountfs: Remove the dead code - fcmp cannot be non-zero here.
CID: 714
2007-04-04 02:00:58 +00:00
pooka 9cc76110cd In sync, skip vnodes which have a null v_data pointer. This is a
workaround for the problem analyzed more deeply in kern/30831.  In
short, the problem is keeping the vnode on the mount point vnode
list during reclaim.  If reclaim happens to sleep (as is a possibility
with smbfs due to calling vrele() and therefore possibly VOP_INACTIVE),
code going through the entire mountpoint vnode list will hit
half-reclaimed vnodes.
2007-04-03 14:18:19 +00:00
pooka de976b706d g/c some commented ltsleep calls accidentally left from newlock2 adaptation 2007-03-30 18:25:02 +00:00
pooka 115fa924ee * abstract ASYNCBIOREAD and let callers freely issue a callback called
from putop.  even though there's only one user currently, makes code
  more readable
* move "delta" to a standard parameter in vntouser and get rid of the
  specialcase vntouser_delta
2007-03-30 17:48:57 +00:00
pooka 78762a532d in userdead assign waiter return value only if there is a waiter for
a particular request
2007-03-29 22:11:43 +00:00
pooka 6ce49d93c1 convert to MALLOC_JUSTDEFINE 2007-03-29 16:30:07 +00:00
pooka 78693816f2 Convert spinlocks & sleep/wakeup to newlock2 locking stuff. Fix a
bunch of bugs.

* park structures are now always allocated from a pool instead of a
  mixed stack/malloc allocation
* get rid of the whole adjbuf concept, always just alloc the maximal
  amount of memory to satisfy a request
* little regression: don't allow interrupting wait from file system
  to userspace; this had problems already before, but now the problems
  really started to shine through.  I'll try to make this work again
  some day.
* fix bmap to return a sensible value in runp
2007-03-29 16:04:26 +00:00
dillo 41627b2c38 Add support for HFS Wrapper (HFS+ volume inside an HFS volume).
Remove offset argument, we should now find an HFS+ volume in any
of its standard places.

Based on work from and test image provided by Pelle Johansson.
2007-03-22 13:21:28 +00:00
dillo 30f474b9e1 Add support for HFS Wrapper (HFS+ volume inside an HFS volume).
Remove offset argument, we should now find an HFS+ volume in any
of its standard places.
2007-03-22 13:21:27 +00:00
dillo 081267c306 Add a few. 2007-03-22 13:20:13 +00:00
pooka 2bddbed0e0 export puffs version of namei ISLASTCN macro to userspace 2007-03-20 18:28:49 +00:00
tsutsui c55df5782d Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-20 11:27:48 +00:00
pooka 8d9c021816 * rework the page cache interaction a bit: cache metadata in the
kernel and flush it out all at once instead of continuous updating
* add support for delivering notifications to the file server about
  when a page was written to (but disabled by default for now).  the
  file server can use this to request flushing or invalidating the
  kernel page cache
2007-03-20 10:21:58 +00:00
dillo 0fb2977031 args.path is in UIO_USERSPACE too.
Fixes statvfs on macppc and PR kern/36012.
Thanks to Magnus Henoch for testing.
2007-03-19 09:16:22 +00:00
pooka 040eb2fb48 Support B_READ|B_ASYNC in strategy by calling biodone() directly
when the file server puts the result.
2007-03-14 12:13:58 +00:00
ad 297c1212be Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 14:16:07 +00:00
ad 4b1d78c00e Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 02:11:28 +00:00
ad 86ed875648 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 01:34:21 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
dillo e100c48afd Fix PR kern/35953 by mange at freemail dot hu (panic on mount):
(hfslib_open_volume) We are only interested in the catalgo and
extents header, so read the first 512 bytes, not the whole first
extent.  Also makes mounting a lot faster.
2007-03-09 22:14:09 +00:00
dillo d0c955805c Remove hfsp directories, they have been reimported as hfs. 2007-03-06 11:31:21 +00:00
dillo 56c3e41252 Complete rename of hfsp to hfs, requested by thorpej. 2007-03-06 11:28:44 +00:00
dillo 25e99827c3 Rename files from hfsp to hfs. 2007-03-06 00:22:04 +00:00
dillo d3fee42230 Temporarily readd, until rename is complete -- renaming the directory
is not enough.

(I need sleep, will clean this up tomorrow.  Sorry for the mess.)
2007-03-06 00:15:50 +00:00
dillo 601515c0d6 Renamed to HFS. 2007-03-06 00:11:38 +00:00
dillo 4f1d6e612e nitial import of (experimental read-only) implementation of Apple
HFS+ file system.

Originally developed for Google Summer of Code 2005 by Yevgeny Binder,
updated and enhanced by me.
2007-03-06 00:10:34 +00:00
dillo 9274a5c0f1 Integrate apmlabel and HFS+ file system. 2007-03-05 23:18:01 +00:00
dillo 9cf283f2a5 Initial import of (experimental read-only) implementation of Apple
HFS+ file system.

Originally developed for Google Summer of Code 2005 by Yevgeny Binder,
updated and enhanced by me.
2007-03-05 23:01:06 +00:00
jnemeth 5e186a4bae yet more caddr_t -> void * fallout 2007-03-04 21:36:38 +00:00
jnemeth 8b8caa1a52 more caddr_t -> void * fallout 2007-03-04 21:18:08 +00:00
yamt 731acd91f9 fix fallout from caddr_t changes. 2007-03-04 15:41:02 +00:00
yamt 7f8abc50b4 fix fallout from caddr_t changes. 2007-03-04 14:53:09 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
pooka 81bb031653 Make wait for the user file server PCATCHable. This makes it
possible to recover the system by just killing processes in case
a file server manages to recurse into itself either by fault of
file server implementation or by pilot error.  The downside is that
the code is extremely hard to follow and practically screams out
for newlock2 (in addition to screaming "bug here").  The whole
PCATCH nonsense and induced megacomplexity can hopefully be avoided
in the future by tweaking other parts of the implementation.
2007-02-27 23:43:23 +00:00
ad b89010bfa3 Destroy the hash locks on final unmount. 2007-02-27 16:11:51 +00:00
drochner 33ac0de1eb -add __unused declarations to make it possible to use only half of it
-fix a bitmask (harmless) and remove two unnecessary ones
We should find a better location for that code!
2007-02-26 12:33:08 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
pooka 8f09e1c196 Properly fix rev 1.44: limit error values from the file server to
positive values of errno and 0.  Otherwise it can return internal values
such as EJUSTRETURN and screw things up.

thanks to Bill for reminding me to revisit this
2007-02-20 19:45:37 +00:00
ad adbb9ec2fa Call genfs_node_destroy() where appropriate. 2007-02-20 16:21:03 +00:00
kochi 2794f98855 fix the problem reported in kern/35457, "cant mount msdosfs on floppy".
Since 1.40, which introduced support for non-DEV_BSIZE media,
mounting msdos floppy returned ENOTTY.

This is because floppy driver does not support DIOCGPART or DIOCWEDGEINFO
ioctl.

Those ioctls should not be a requirement for mounting msdosfs.

This patch is made by Christian Biere.
2007-02-17 18:39:15 +00:00
hannken 198beb0314 Make fstrans(9) the default helper for file system suspension.
Replaces the now obsolete vn_start_write()/vn_finished_write().
2007-02-16 17:23:53 +00:00
pooka ddd5ed5765 Check against root node cookie when fetching a new vnode and invoke
VFS_ROOT() if the cookies match.  Without this fix, if the root
vnode was reclaimed, doing lookups for dotdot from the root vnode
was possible.  In practice this occured only through getcwd.
2007-02-16 16:37:55 +00:00
pooka cd12688f17 Sanity-check linklen returned from file server in READLINK. 2007-02-15 19:50:54 +00:00
ad f918a311cb Fix error in previous. 2007-02-15 16:18:23 +00:00
ad 9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
pooka c1b906f44a Hide the debug prints behind PUFFSDEBUG instead of DEBUG. Make the
latter define the former.
2007-02-15 12:14:34 +00:00
pooka cd66766e1a * in write, do sync pageflush for the ubc case every 64k, otherwise
the user file server can't really keep up and just writing and writing
  may result in kernel memory exhaustion.  this lossage is also partially
  due to the stupid way mtime + size info is handled currently, but that
  should change soon (*knock knock* ;)
* score a few debug printfs
2007-02-10 13:12:43 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
pooka b2668f252f honor B_ASYNC 2007-02-09 08:53:51 +00:00
pooka 95700e9a12 assign value for strategy output parameter b_resid instead of decreasing it 2007-02-09 08:15:41 +00:00
pooka 692448474d If the file server doesn't support write, don't use genfs_null_putpages
for putpages, as it assumes a vnode doesn't have any pages.  For
mounts using the page cache this is simply not true.  Rather,
prevent opening a regular file in write-mode.  That way a vnode
can never have dirty pages which would need to be flushed (i.e.
written).
2007-02-08 22:55:06 +00:00
pooka 82b88def96 chuq shone arcane wisdom on me: b_bcount comes in, b_resid goes out 2007-02-08 05:09:25 +00:00
pooka b7a2d4ecbb Don't block and wait for file server response in case strategy is
run in pagedaemon context: it gives the file server way more control
over the fate of the entire kernel than what we're comfortable with.
2007-02-08 04:52:23 +00:00
pooka ebfeab6747 Limit errors from puffs_lookup to 0, EJUSTRETURN and ENOENT, as
that's what namei/lookup expects.
2007-02-06 01:53:11 +00:00
chs 0507747213 more fixes for the new vnode locking scheme:
- don't use SAVESTART in calls to relookup() from unionfs,
   just vref() the desired vnode when we need to.
 - fix locking and refcounting in the unionfs EEXIST error cases.
 - release any vnode locks before calling VFS_ROOT(), vfs_busy() is enough.
   this allows us to simplify union_root() and fix PR 3006.
 - union_lock() doesn't handle shared lock requests correctly,
   so convert them to exclusive instead.  fixes PR 34775.
 - in relookup(), avoid reusing "dp" for different purposes,
   the error handling wasn't right.  (actually just get rid of dp.)
   also, change relookup() to ignore LOCKLEAF and always return the
   vnode locked since the callers already expect this.
2007-02-04 15:03:20 +00:00
pooka 3f280a11a4 fstrans owner automatically gets a normal lock, don't need to lazy lock
pointed out by hannken
2007-02-03 16:29:05 +00:00
hannken 4d607243ba Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
2007-01-29 15:42:50 +00:00
hubertf eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
pooka 842f8f2a8a don't need pi_lock for struct member access, so don't take it 2007-01-28 00:27:33 +00:00
cbiere b70ba117e6 * Added missing cast in isonum_712().
* Added const-qualifiers.
 * Removed unnecessary duplicate prototypes.
 * Use the endian conversion functions from <sys/endian.h>.
2007-01-27 07:20:31 +00:00
cbiere 0108d79ceb Use the endian conversion functions from sys/endian.h. 2007-01-27 07:18:10 +00:00
pooka 0eaa3c5c67 We don't handle fsync in checkop anymore, so direct the fifoop fsync
also to a place less panicy, namely fifo_fsync (because currently the
metadata information is update when the node is changed.  This will
probably change soon, though).
2007-01-26 23:25:56 +00:00
pooka d2595d03c5 Initial attempt at suspend/snapshot support for userspace file
servers.  This is still pretty much on the level "if it breaks ...".
It should work for single-threaded servers which handle one operation
from start to finish in one go.  Also, it does not yet totally
correctly synchronize metadata and data in some cases.  So needless
to say, it needs improvement, but it is possible that will have to
wait for some lock revampage.
2007-01-26 22:59:49 +00:00
pooka 61ffb7330d if strategy fails, set bp->b_error and B_ERROR 2007-01-25 23:43:57 +00:00
pooka 2dcf5f359a don't hold spinlocks (except vnode interlock) when doing vget() 2007-01-25 17:43:56 +00:00
pooka 7fa4b7d96a fix comment (no functional change) 2007-01-23 18:27:50 +00:00
reinoud be6d76ac92 Fix typo
-                * assoicated with this mount point, start over.
+                * associated with this mount point, start over.
2007-01-22 16:07:33 +00:00
pooka 2874c0e4be optimize a bit: don't flush pages for vnodes which have no references
in the kernel or links in the backend
2007-01-21 16:29:31 +00:00
pooka 092746dfb6 remove diagnostic printf 2007-01-21 14:52:20 +00:00
christos 6b98a17401 - If the filesystem lives on a wedge, then we try to get wedge information
since DIOCGPART is going to fail. Unfortunately there is no way to get the
  geometry information we need from the wedge; it would be nice for wedges
  to support a geometry ioctl. The values we cannot retrieve are marked with
  XXX.
- Add a lot more debugging.
2007-01-20 23:34:09 +00:00
christos 226df6aaef only change atime on access. 2007-01-19 20:10:36 +00:00
pooka 7f8363fa95 hannken noted that the latest gcc (?) complains about uninitialized
variable use in puffs_strategy() for "dowritefaf" (incorrectly)
and "error" (correctly, although the function is practically of
type void)
2007-01-19 17:52:01 +00:00
pooka b2a7b240df In case the fs server is in the kernel doing an operation on a
completely different file system, we still might re-enter the same
puffs fs in case we execute something on the other file system,
which wants to get a new vnode and ends up recycling a puffs vnode
for the purpose.  In this case the fs server will sleep in the
kernel until it itself handles the operation .... which of course
is a slightly unlikely event.

After analyzing the path from getcleanvnode() to the vnode cemetary,
identify that fsync and putpages (strategy) are the ones in danger
of striking a deadlock deal.  Abuse the vnode flag VXLOCK to tell
them "this vnode is irreversably going to meet its maker, don't
care about user server return values" (failure is not acceptable
down the vgonel() path) and issue the respective operations as
Fire-And-Forget (FAF) operations.  no wait -> no deadlock.

This of course is a "fix" skating on thin ice.  A better, more
generic solution is already in sight, but will take more effort to
implement.
2007-01-19 14:59:50 +00:00
hannken 1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
pooka 2a1cb9e956 debug print requests going into the queue 2007-01-19 13:01:15 +00:00
reinoud a6abe0260b Fix important directory lookup bug that could result in an endless loop. It
fixes the case where a directory lookup is done in a directory has never
been visted/listed; the search optimalisation that searches the directory
from where it left behind the last time would never reach the initial
offset of zero since it would always have at least processed one entry.
2007-01-17 13:02:44 +00:00
reinoud 3c9b632bb2 Use the generic clock_ymdhms_to_secs() instead of home-brewn version to
translate UDF timestamps to timespec.
2007-01-17 12:49:01 +00:00
pooka fb784fec83 g/c revoke msg structure 2007-01-16 22:38:19 +00:00
pooka acd0be5c12 * don't wait for the answer of VOP_RECLAIM, just fire-and-forget
* revoke puffs_revoke.  we can deal with it just by calling genfs_revoke
2007-01-16 21:58:49 +00:00
pooka 84906bc20f Store puffs_node's on lists hashed with the cookie value instead
of just one flat list.
2007-01-15 23:29:08 +00:00
pooka a18a275954 * do not accept the directory cookie as the result of a lookup (otherwise
we'd be locking against ourselves)
* do not accept duplicate cookies when creating new nodes
2007-01-15 20:40:29 +00:00
pooka 5b381d2cab Since fsync is really putpages + fsync, check for both separately
instead of using just putpages to decide the op's faith.

And the real beef in this commit is of course a tyop fix in a comment.
2007-01-11 16:08:58 +00:00
pooka a96ba7013e In vfs_sync(), call VOP_PUTPAGES() for dirty vnodes directly instead
of rolling around VOP_FSYNC().  The user server will be given the
VFS_SYNC instruction and it can do its own equivalent of VOP_FSYNC()
if it pleases, no need for the kernel to explicitly issue #{vnodes}
FSYNCs.
2007-01-09 23:10:23 +00:00
pooka 5959243a1b comment out flushmulti for now, it's not done and kdump will complain
as mjf noted
2007-01-09 21:59:05 +00:00
pooka 8d142a9d0c Introduce flush operations, which the fs server can use to control
kernel caching.  Currently supported are only flushing the name
cache for a directory or flushing the name cache for the entire fs.

Also, get rid of PNODE_INACTIVE status, since it was racy and
essentially didn't work.  All this on top of being useless in the
first place ....
2007-01-09 18:14:31 +00:00
pooka a0fc370456 in vfs_sync flush page cache only for vnodes with dirty pages, not for
vnodes with pages (dirty or otherwise)
2007-01-09 18:01:05 +00:00
pooka 7ed9318946 vfs sync, flushes regular file data only (user server can take care of
flushing any metadata it might have hidden away)
2007-01-07 19:28:48 +00:00
pooka 8456438f43 getcwd wants eofflag - set eofflag in readdir if amount of data is 0 2007-01-07 00:53:13 +00:00
elad 1e70d64818 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 16:55:29 +00:00
elad faad322a82 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 15:42:37 +00:00
reinoud f77d911f26 Forgot one place for UDF_ICB_FILETYPE_RANDOMACCESS. 2007-01-04 04:18:00 +00:00
reinoud 1d48d18121 Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
2007-01-04 04:15:43 +00:00
reinoud 636b044677 Fix compilation issue when specifying different flags or compiling with a
different compiler. Thanks to Jared for noting.
2007-01-04 02:42:19 +00:00
reinoud e54e795b0d Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
2007-01-04 02:02:40 +00:00
pooka b613212772 * check userspace version and prevent incompatible mount
* some general maintenance
2007-01-02 15:51:21 +00:00
elad d4e1860d1a Add KAUTH_SYSTEM_CHSYSFLAGS so we can get rid of the last three
securelevel references (ufs, ext2fs, tmpfs).

Intentionally undocumented.
2007-01-02 11:18:56 +00:00
pooka 4f931d80b2 * fix locking gotchas when trying to unlink "."
* return standard EPERM when trying to unlink a directory
* reorder some checks in rmdir avoid problems if trying to rmdir ".."

jmmv ok
2007-01-02 11:02:19 +00:00
pooka 4040720335 In rename, tdvp == tvp holds if we are renaming a directory to "."
(XXX: for all the sense that makes).  Deal with it gracefully here
for now.
2007-01-02 00:14:15 +00:00
pooka ab88ea8145 remove r/o mount check done also in vfs lookup() 2007-01-01 23:07:36 +00:00
pooka b4b651b5e3 async update node metadata for spec- and fifoops 2007-01-01 20:16:36 +00:00
pooka 76ac7d114d properly handle VOP_REMOVE case where vp == dvp 2007-01-01 20:14:36 +00:00
pooka 06ebafad63 explicitly disable ioctl and fcntl for now - support has bitrotted 2007-01-01 14:41:21 +00:00
pooka 7983048ec7 * use PUFFS_KFLAG_NOCACHE to also signal that we don't want the namecache
* enter files into the namecache immediately when new nodes are created
  (if it's a caching mount, of course)
2006-12-30 01:29:03 +00:00
elad a220cee1c3 Remove support for immutable and append-only flags on ptyfs. 2006-12-29 18:05:17 +00:00
pooka 99c833023e rename the kernel-provided componentname to puffs_kcn; libpuffs now
provides puffs_cn built on top of it
2006-12-29 15:38:37 +00:00
pooka 73f96ea2e7 Don't allow calls to be queued while MOUNTING. We don't make any
kernel->server calls at that time and it allows a window where
operations use an incorrect root node cookie.

XXX: there's still a (very much smaller and biglock safe) race, but
that's going to be solved by some more thorough restructuring
2006-12-29 01:37:11 +00:00
wiz 3ed1aa9185 Spell "separate" correctly. From Zafer Aydogan. 2006-12-25 18:39:47 +00:00
wiz 19c7b24184 Spell "schedule" correctly. From Zafer Aydogan. 2006-12-25 18:36:05 +00:00
wiz cc67b3a29f Spell "algorithm" correctly. From Zafer Aydogan. 2006-12-25 18:32:16 +00:00
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
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
christos f89dbcf8f7 Coverity CID 2435: Add KASSERT before NULL deref (from Arnaud Lacombe) 2006-09-29 18:30:37 +00:00
reinoud d9df4ed24c Add `vfs.udf.verbose' sysctl when running a DEBUG kernel to dynamically set
the udf_verbose variable. So when something goes wrong, it can be examined
on the spot without needing to reboot a new kernel and possibly loosing
state.
2006-09-29 01:36:28 +00:00
reinoud 695fa2b8b8 Fix lookup bug that could result in not finding the last entry. The check
for the cycling was too early. Also fix potential endless loop when the
last entry was deleted.
2006-09-28 19:57:26 +00:00
aymeric a4a3d448f2 fix adosfs_readdir() so that we can list directories on AmigaOS filesystems.
. get rid of struct adirent which didn't match struct dirent anymore
. fix cookies, move all the code handling them to the end of the function

Includes many minor changes to the code of this function.
2006-09-23 22:47:11 +00:00
xtraeme 729d0a0184 Apply patch from PR kern/34583 sent by Rhialto, quoting him:
"Add a 3rd entry in the cache, which keeps the end position
 from just before extending a file.
 This has the desired effect of keeping the write speed constant."

And yes, that helps a lot copying large files... always at full speed
now. This closes my PR kern/30868 "Poor performance copying large files
on msdosfs".

Also remove a 2 if-statements testing the same condition, combine them.

All that from Rhialto, thank you very much.
2006-09-22 17:45:21 +00:00
reinoud ce2c68fd18 Make VOP_LOOKUP's O(1) instead of O(n log(n)) giving a speedup of 7500% on
a 1400 file directory.
2006-09-19 23:59:16 +00:00
reinoud 4911612931 Fix serious file-corruption issue on sparable partitions. 2006-09-19 22:00:38 +00:00
reinoud 49ec3b4779 Fix panic when the sparable table didn't read in correctly. 2006-09-19 15:34:23 +00:00
christos e15ade632a Avoid empty if. 2006-09-13 00:54:00 +00:00
reinoud 0f0ed58759 Fix copying too much space from a small buffer. The chances of it actually
happening are small but corrupt media could trigger it.
2006-09-05 22:30:52 +00:00
reinoud 6014bf8aa0 Fix locking scheme in udf_mount() to follow more the other filingsystems.
For yet unknown reasons passing the LOCKLEAF flag to namei() did return a
locked vnode as was meant but would panic when a raw device was passed.
2006-09-05 17:03:04 +00:00
christos 61f2f34223 add missing initializers 2006-09-03 21:29:37 +00:00
christos 2e139ee910 add missing initializers 2006-09-03 07:08:59 +00:00
christos 644f53e4e9 add missing initializers 2006-09-03 06:51:04 +00:00
christos ce2bae8870 comment out empty code 2006-09-03 06:49:30 +00:00
christos 94de7229ef use c99 initializers 2006-09-03 06:48:26 +00:00
christos 9c03e39ea2 add missing initializer 2006-09-03 05:27:28 +00:00
christos 309d51fb22 add missing initializers 2006-09-03 04:56:33 +00:00
christos 88112b2ad5 add missing initializers 2006-09-02 07:30:30 +00:00
christos 66f851cf96 add missing initializers 2006-09-02 07:12:11 +00:00
reinoud 037fe176f0 Add shortcut for struct long_ad 's Unique ID hint that covers the lower 32
bits of the targeted files 64 bits Unique ID for recovery purposes.
2006-08-31 21:38:14 +00:00
christos eef4aaba6b Fix getdirentries() issue from FreeBSD PR - 78953 Quoting from that:
If you perform this request on a directory with exactly 50 files
(plus '.' and '..' which brings the total to 52 objects), the first
reply for the SMB server completely satisfies the query (server
side is Windows 2000 Professional).

The smbfs client then performs a TRANS2_FIND_NEXT2 using the last
file name as the resume key.  The response returns a SearchCount
of zero (ctx->f_ecnt == 0) and an EndOfSearch code of zero.

Any attempt to get more entries with calls to TRANS2_FIND_NEXT2
result in Badfid (bad file descriptor).  I suspect the return of
SearchCount of zero means that end-of-search has been reached and
the Sid is now closed.

The solution is to set "SMB_RDD_EOF | SMB_RDD_NOCLOSE" after getting
back a zero SearchCount,  I've tested this in the field on a quite
a few systems, aggressively accessing Windows shares over smbfs
and it appears flawless.

I was initially concerned about the possibility of resource exhaustion
on the Windows server. I was afraid by not officially closing the
search, it would leave a resource hung-up and over time, exhaust
some sort of "open search table" limit.  I've since convinced myself
this is NOT the case.

Windows needs to be able to handle clients that come and go over
time.  If the search is not closed, Windows will close it if it
finds it needs more resources.  I've testing this on directory
searches descending into 10's of thousands of folders, with 100's
of thousands of files.
2006-08-28 15:56:56 +00:00
christos e28a71d80a add missing initializers 2006-08-28 00:35:22 +00:00
christos 428665231e correct bogus loop test; used to be always true. 2006-08-28 00:28:51 +00:00
tsutsui b5825ccf25 Change types from int8_t to char for arrays which store char names. 2006-08-26 14:04:55 +00:00
reinoud 5b2c16b797 Fix small though important errors in the Ecma-167 structure definitions. 2006-08-25 17:43:51 +00:00
reinoud 7915eb6468 Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
2006-08-22 16:52:41 +00:00
reinoud 5223c4995c Make a better guess on VAT locations so discs that are semi-standard
formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
2006-08-21 23:52:19 +00:00
reinoud 445a215f26 Fix spurious panic when twice remounting a bad filingsystem. It then gets
the same memory block allocated as before and it bombs out on its
descriptor pool allready being initialised. It turns out that the pool was
not allways destroyed. This fix ought to clean it up whatever the cause of
the mishap that results in a reject.
2006-08-21 22:23:09 +00:00
gdt 7db024f8e7 When mounting an MSDOS fileysystem, do not require that bytes 252 and
253 of the superblock be zero.  Searching the net failed to find any
justification for checking these bytes; all available references say
that they are part of the boot code and not BOOTSIG2 and BOOTSIG3.

Modify the MSDOS 7.1 bootsector definition to have 420 bytes of boot
code and no BOOTSIG[23], rather than 418 bytes of boot code, to follow
available references and apparent Windows practice.  A test build
showed that these defines are not used other than in the check removed
by this commit.

Patch tested on netbsd-3, and enabled mounting of a 4 GB CF formatted
under Windows XP and then in a digital camera.  The CF was previously
unmountable.

Concept approved on tech-kern by christos@ and martin@.
2006-08-14 14:06:26 +00:00
reinoud 177a68d51b Fix comment; it stated a mimimum of 128 translations duh! a maximum it is! 2006-08-11 23:15:30 +00:00
reinoud 9e6b675112 Fix panic on badly or curruptly formatted discs due to an oddity in the
error handling chain.

If NetBSD 4.0 is allready branched at this time this ought to be pulled up.
2006-08-10 12:39:56 +00:00
reinoud 81e6c818c1 The local variable `index' seems shadowing an inbuild gcc variable (???)
when compiling from userland (kernel ok) so rename the variable to Index to
avoid the confusing warning.
2006-08-10 12:26:44 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
reinoud b1b70c855b Fixing a bad case of walking/writing out of allocated space.... the
allocated space was 2048 bytes, but when adding 1024 to the variable
`unix_name' to split the allocated space in half it effectively starts just
OUTSIDE the allocated space. This ought to fix memory corruption bugs when
using UDF.

This is a routine to revisit one day.
2006-07-09 13:58:47 +00:00
martin 6bfe6be406 Make it compile on 64 bit machines 2006-07-06 21:55:06 +00:00
martin 931985243c Redo previous differently - just use time_second.
Pointed out by Frank Kardel.
2006-07-01 10:12:36 +00:00
martin c627e877cf Make it compile post time-counter merge 2006-07-01 08:42:39 +00:00
tron a0d2802c69 Make this compile again. 2006-06-20 09:17:14 +00:00
christos 18b73e414c Don't allocate too much stuff on the stack. 2006-06-20 03:22:12 +00:00
christos 0c1391f078 remove ; from }; 2006-06-12 00:20:21 +00:00
christos 06595cb85e stack polics: Don't allocate 4K on the stack.
remove ; from };
2006-06-12 00:18:06 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
yamt 725fa55be5 hide more by ifdef _KERNEL. 2006-05-27 09:12:31 +00:00
yamt fa971123c3 revive copyright notice for the code derived from libc/locale/utf2.c.
i've asked jdolecek@ about this, but got no reply.
2006-05-20 08:28:27 +00:00
yamt ad696ab2dc don't try to dereference kauth_cred_t. 2006-05-15 12:51:21 +00:00
yamt 240883e159 include kauth.h for NOCRED. 2006-05-15 11:16:16 +00:00
christos 641b7ad824 More kauth fallout. 2006-05-15 01:29:02 +00:00
christos fc6d984beb kauth fallout 2006-05-15 00:05:16 +00:00
elad fc9422c9d9 integrate kauth. 2006-05-14 21:31:52 +00:00
he 355013fbd7 Don't use MALLOC_DECLARE() unless _KERNEL is defined.
Fixes build problem of usr.bin/fstat/ for vax.
2006-05-14 12:25:11 +00:00
mrg e012cb30a7 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-11 01:12:21 +00:00
mrg 79652075f7 ntfs_runtovrun takes u_int8_t * not caddr_t 2006-05-11 01:11:11 +00:00
christos 93f1cb3704 Do the count check after we process getargs. 2006-04-28 19:17:45 +00:00
snj d97db3840b s/allready/already/ 2006-04-25 02:19:31 +00:00
christos 5da80a50f2 Coverity CID 1138: Add KASSERT before deref. 2006-04-15 04:06:03 +00:00
christos 4a420185b2 Coverity CID 1197: Add KASSERT before deref. 2006-04-15 04:02:40 +00:00
christos daeb76efcb Coverity CID 1135: Add KASSERT before deref. 2006-04-15 04:01:41 +00:00
christos 2ce6f7c5c6 Coverity CID 1093: Fix NULL deref. 2006-04-15 03:59:23 +00:00
christos 03372c0db6 Coverity CID 1001: Avoid NULL deref. 2006-04-15 03:56:25 +00:00
christos 9e36ae3b49 Coverity CID 839: Add KASSERT before deref. 2006-04-15 02:58:12 +00:00
christos f16f3462cc Coverity CID 838: Add KASSERT before deref. 2006-04-15 02:56:51 +00:00
christos be213d0c34 Coverity CID 2503: Remove bogus uninitialized deref. 2006-04-15 02:55:06 +00:00
christos ceeda7c0ed Coverity CID 721: Add KASSERT since error != 0 conditions all returned, and
ifdef out dead code.
2006-04-15 02:53:49 +00:00
christos 9071fc0f28 Coverity CID 2508: Initialize variable 2006-04-15 02:44:16 +00:00
christos 56ef669e31 Coverity CID 2863: Check for NULL before freeing. 2006-04-15 02:42:08 +00:00
christos 41d5f0d550 Coveriry CID 733: Remove dead code. 2006-04-14 22:05:07 +00:00
christos 1c2c11fc00 Remove dead code. 2006-04-14 22:03:18 +00:00
christos 986cf947f1 Coverity CID 715: Remove dead code. 2006-04-14 22:00:14 +00:00
christos 5cf38f035b Strip the chrooted portion of the path from the reported pty path. Reported
and tested by Lasse Kliemann. Thanks!
2006-04-13 17:44:24 +00:00
xtraeme 0998485b9d make this build again (initiliaze ntmp). 2006-04-11 16:57:47 +00:00
christos 139332cff1 Coverity CID 2860: Free malloced resources on mount error. 2006-04-11 14:12:53 +00:00
riz 9f6ad5fff1 Swap the order of the tf_gen and tf_id members of struct tmpfs_fid,
since tf_id needs 8-byte alignment on some architectures (like amd64).
struct tmpfs_fid now fits in 16 bytes on amd64 again.
OK matt@
2006-03-31 20:27:49 +00:00
martin 625f1bbe61 Restrict generation numbers to 32bit values - we would have had to bump
_VFS_MAXFIDSZ to 24 otherwise for 64bit archs.
2006-03-26 20:18:58 +00:00
christos f8912e4424 PR/32986: Kouichirou Hiratsuka: Don't proceed with unmounting the filesystem
if vflush failed. Thank to Jeff Ito for adopting a similar fix from FreeBSD.
2006-03-20 19:54:15 +00:00
christos 5a57baa413 don't use MALLOC with a non-constant size; use malloc instead. 2006-03-17 23:29:07 +00:00
christos bd047b110f remove trailing newlines 2006-03-05 16:55:44 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
wiz 5d1e8b2745 Fix some typos. 2006-02-25 02:28:55 +00:00
thorpej 58853410ae Use device_class() instead of accessing dv_class directly. 2006-02-21 04:32:38 +00:00
christos 61315901b1 PR/31850: Geoff Wing: tmpfs does not honor sticky directories. 2006-02-21 03:19:45 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
jmmv 064fbe7e18 Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95.  Found by he@.
2006-02-16 14:57:50 +00:00
christos 6547cf74f3 make the include files usable from userland. 2006-02-10 16:00:02 +00:00
reinoud 979954f179 VND and harddiscs have their own defect free space management. 2006-02-04 23:21:43 +00:00
reinoud 8c7d758cbc Change a comment into a TODO and fix up case where we could return an
illegal allready-freed memory space.
2006-02-04 21:29:11 +00:00
christos d3ef798d46 protect the whole file, not parts of it. 2006-02-02 21:58:40 +00:00
reinoud 6ee0cb5d5d Replace reinclude protection names with less generic versions. 2006-02-02 16:14:26 +00:00
reinoud 73bc73c9ad De __P() prototypes. 2006-02-02 15:57:35 +00:00
reinoud 14ab2cc9e6 Fix header re-inclusion protection defines to a less generic naming
scheme.
2006-02-02 15:52:23 +00:00
reinoud aba87fd86c Fix $NetBSD$ tags. (sorry) 2006-02-02 15:38:35 +00:00
reinoud 09457a8a6e Initial import of a UDF file system implementation for NetBSD.
Finally the logic glue and the set distribution lists modifications.
2006-02-02 15:26:32 +00:00
reinoud cff5e7ad2c Initial import of a UDF file system implementation for NetBSD.
The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
2006-02-02 15:19:15 +00:00
jmmv 1aa1083c54 Cut a too long line introduced during the conversion to lwps. 2006-01-26 20:07:34 +00:00
tsutsui 7a10e95ea9 free() -> dealloc() for _STANDALONE. 2006-01-26 16:27:43 +00:00
christos 9c6e6ff8b2 Protect against uio_lwp being NULL from Pavel Cahyna 2006-01-14 23:49:59 +00:00
yamt 403fb83166 smbfs: use curlwp rather than uio->uio_lwp.
the latter is a garbage in the case of UIO_SYSSPACE.
PR/32499 from Juan RP.
2006-01-12 13:36:17 +00:00
wrstuden 160f564c51 Change union_unmount() to not play with the fs root vnode explicitly.
Let it get recycled along with all of the others. This is important
as if the root vnode has already been reclaimed, then we get a panic
when we try to vget it.

This addresses PR: kern/31382
2006-01-05 20:31:33 +00:00
tsutsui 1f5055228d Add preliminary support for System V Boot File System.
Written by UCHIYAMA Yasushi <uch@netbsd>.
2005-12-29 14:53:45 +00:00
chs 0545b6e0cb changes for making DIAGNOSTIC not change the kernel ABI:
- for structure fields that are conditionally present,
   make those fields always present.
 - for functions which are conditionally inline, make them never inline.
 - remove some other functions which are conditionally defined but
   don't actually do anything anymore.
 - make a lock-debugging function conditional on only LOCKDEBUG.

as discussed on tech-kern some time back.
2005-12-27 04:06:45 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
jmmv f37f56be99 Remove a conditional by always using inlined functions in favour of macros.
This way, the code is clearer and there shouldn't be any performance
difference (if the compiler DTRT).  Suggested by chs@.
2005-12-24 12:31:57 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt 1fa8bcda47 VFS_TO_TMPFS: remove a wrong assertion.
it's wrong because TMPFS_PAGES_MAX can be decreased.
2005-12-06 21:46:34 +00:00
christos aa1c65555d protect against multiple inclusion instead of forbidding their access from
userland, and #ifdef _KERNEL all their kernel functions.
2005-12-03 22:16:16 +00:00
christos 4bffed72de - protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
2005-12-03 17:34:43 +00:00
yamt 221616873d merge yamt-readahead branch. 2005-11-29 22:52:02 +00:00
dan 3a01b7a8ba take into account memory used for file cache pages, and wired pages,
when calculating potential free space
2005-11-28 22:28:36 +00:00
dan cbba09ed4d simplify calculation of free swap space using uvm-exported statistics,
with thanks to yamt@ for useful hints.
2005-11-28 22:06:20 +00:00
yamt 6a17dd42f4 - ignore truncation for VCHR/VBLK/VFIFO as it used to be
before yamt-vop merge.  PR/32049 from Atsushi Onoe.
- reject setattr which attempts to change size of VLNK/VSOCK.
2005-11-11 15:50:57 +00:00
yamt 807ce4c6fc tmpfs_reg_resize: drop swap slots on truncation.
fix a problem pointed by jmmv@.
2005-11-08 23:04:03 +00:00
christos fe1de4d6e3 PR/32003: Brian Buhrow: msdosfs doesn't properly zero out high cluster data
on non-FAT32 msdos filesystems.
2005-11-04 21:04:20 +00:00
yamt a748ea88dd merge yamt-vop branch. remove following VOPs.
VOP_BLKATOFF
	VOP_VALLOC
	VOP_BALLOC
	VOP_REALLOCBLKS
	VOP_VFREE
	VOP_TRUNCATE
	VOP_UPDATE
2005-11-02 12:38:58 +00:00
dyoung ba91bb71cf Bug fix: correct the sense of an if-condition in tmpfs_spec_close:
because VOP_UPDATE() usually succeeded, spec_close() was not usually
called.  Only skip the spec_close() step if VOP_UPDATE() returns
an error result.  Now /dev/watchdog works as expected when /dev/
is a tmpfs; previously, it was impossible to disarm a user-tickled
watchdog.
2005-11-02 05:41:50 +00:00
dyoung b441f8100f Bug fix: change tmpfs_spec_bwrite from tmpfs_bwrite to vn_bwrite,
per yamt's suggestion.  Previously, if /dev/ was mounted on a tmpfs,
block device buffers were never flushed to disk.  Trying to unmount
a dirty filesystem (umount /dev/wd0e, say) caused an endless stream
of vflushbuf warnings, because tmpfs_bwrite was not flushing buffers.
The fix told to me by yamt solves the problem.
2005-11-02 05:39:16 +00:00
christos f229ea7f53 make debugging code compile after 64 bit inode changes. 2005-10-23 04:28:53 +00:00
simonb 30ab8089df Update the mod and access times directly from ptyfs_read() and
ptyfs_write() rather than setting a flag and updating these times
through ptyfs_itimes() at some indeterminate time in the future.
However, just use the "time" variable to set the times instead of
using a potentially expensive call to nanotime().  A HZ resolution
on these timestamps is more than enough.

(Possibly incomplete) fix for PR kern/31430.
OK'd be christos@.
2005-10-12 15:23:33 +00:00