Commit Graph

682 Commits

Author SHA1 Message Date
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