Commit Graph

1364 Commits

Author SHA1 Message Date
Tim J. Robbins
07a65634d9 Make oldsize in smbfs_getattr() 64 bits wide instead of 32 to avoid
truncation when files are larger than 4GB.
2003-12-22 12:33:31 +00:00
Tim J. Robbins
ce55c2612c Avoid sign extension when casting signed characters to unsigned wide
characters in ntfs_u28(). This fixes the conversion of filenames containing
single-byte characters with the high bit set.
2003-12-16 01:52:54 +00:00
Max Khon
0f4e4130e1 Make msdosfs long filenames matching case insensitive again.
PR:		59765
Submitted by:	Ryuichiro Imura <imura@ryu16.org>
2003-12-08 08:32:20 +00:00
Dag-Erling Smørgrav
b331ec01c4 Constify, and add an API function to find a named node in a directory. 2003-12-07 17:41:19 +00:00
Dag-Erling Smørgrav
7caaf6c9c9 Minor whitespace and style issues. 2003-12-07 17:40:00 +00:00
Dag-Erling Smørgrav
e4b3851568 Remove useless SMP check code. 2003-12-07 17:37:44 +00:00
Scott Long
774114995e Re-arrange and consolidate some random debugging stuff 2003-12-07 05:04:49 +00:00
Alexander Kabaev
c391349841 Fix vnode locking in fdesc_setattr. Lock vnode before invoking
VOP_SETATTR on it.

Approved by:	re@ (rwatson)
2003-11-19 04:14:42 +00:00
Don Lewis
95c6cd2f4b Use "fip->fi_readers == 0 && fip->fi_writers == 0" as the condition for
disposing fifo resources in fifo_cleanup() instead using of
"vp->v_usecount == 1".  There may be other references to the vnode, for
instance by nullfs, at the time fifo_open() or fifo_close() is called,
which could cause a resource leak.

Don't bother grabbing the vnode interlock in fifo_cleanup() since it no
longer accesses v_usecount.
2003-11-16 01:11:11 +00:00
David Schultz
95eac68fea - A sanity check in unionfs verifies that lookups of '.' return the
vnode of the parent.  However, this check should not be performed if
  the lookup failed.  This change should fix "union_lookup returning
  . not same as startdir" panics people were seeing.  The bug was
  introduced by an incomplete import of a NetBSD delta in rev 1.38.
- Move the aforementioned check out from DIAGNOSTIC.  Performance
  is the least of our unionfs worries.
- Minor reorganization.

PR:		53004
MFC after:	1 week
2003-11-14 08:23:13 +00:00
Poul-Henning Kamp
98d87dfecd Initialize b_iooffset correctly. 2003-11-13 09:58:09 +00:00
Poul-Henning Kamp
2178f0e340 Don't mess around with spare fields of public structures. 2003-11-12 09:54:07 +00:00
Poul-Henning Kamp
1054ba63be Don't mess about with spare fields in public structures. 2003-11-12 09:52:10 +00:00
Robert Watson
eca8a663d4 Modify the MAC Framework so that instead of embedding a (struct label)
in various kernel objects to represent security data, we embed a
(struct label *) pointer, which now references labels allocated using
a UMA zone (mac_label.c).  This allows the size and shape of struct
label to be varied without changing the size and shape of these kernel
objects, which become part of the frozen ABI with 5-STABLE.  This opens
the door for boot-time selection of the number of label slots, and hence
changes to the bound on the number of simultaneous labeled policies
at boot-time instead of compile-time.  This also makes it easier to
embed label references in new objects as required for locking/caching
with fine-grained network stack locking, such as inpcb structures.

This change also moves us further in the direction of hiding the
structure of kernel objects from MAC policy modules, not to mention
dramatically reducing the number of '&' symbols appearing in both the
MAC Framework and MAC policy modules, and improving readability.

While this results in minimal performance change with MAC enabled, it
will observably shrink the size of a number of critical kernel data
structures for the !MAC case, and should have a small (but measurable)
performance benefit (i.e., struct vnode, struct socket) do to memory
conservation and reduced cost of zeroing memory.

NOTE: Users of MAC must recompile their kernel and all MAC modules as a
result of this change.  Because this is an API change, third party
MAC modules will also need to be updated to make less use of the '&'
symbol.

Suggestions from:	bmilekic
Obtained from:		TrustedBSD Project
Sponsored by:		DARPA, Network Associates Laboratories
2003-11-12 03:14:31 +00:00
Don Lewis
8d0c247562 If fifo_open() is interrupted, fifo_close() may not get called, causing
a resource leak.  Move the resource deallocation code from fifo_close()
to a new function, fifo_cleanup(), and call fifo_cleanup() from
fifo_close() and the appropriate places in fifo_open().

Tested by: 	Lukas Ertl
Pointy hat to:	truckman
2003-11-10 22:21:00 +00:00
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
Scott Long
6565282c62 Add hooks for translating directories entries using the iconv methods.
Submitted by: imura@ryu16.org
2003-11-05 06:56:08 +00:00
Scott Long
c5a1bf1b20 Add udf_UncompressUnicodeByte() for processing cs0 strings in a way that the
iconv mehtods can handle

Submitted by: imura@ryu16.org
2003-11-05 06:55:23 +00:00
Alexander Kabaev
ca430f2e92 Remove mntvnode_mtx and replace it with per-mountpoint mutex.
Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to
operate on this mutex transparently.

Eventually new mutex will be protecting more fields in
struct mount, not only vnode list.

Discussed with: jeff
2003-11-05 04:30:08 +00:00
Alexander Kabaev
cb9ddc80ae Take care not to call vput if thread used in corresponding vget
wasn't curthread, i.e. when we receive a thread pointer to use
as a function argument. Use VOP_UNLOCK/vrele in these cases.

The only case there td != curthread known at the moment is
boot() calling sync with thread0 pointer.

This fixes the panic on shutdown people have reported.
2003-11-02 04:52:53 +00:00
Alexander Kabaev
9185a9f5e3 Remove now unused variable. 2003-11-01 15:04:50 +00:00
Alexander Kabaev
492c1e68fb Temporarily undo parts of the stuct mount locking commit by jeff.
It is unsafe to hold a mutex across vput/vrele calls.

This will be redone when a better locking strategy is agreed upon.

Discussed with: jeff
2003-11-01 05:51:54 +00:00
Alexander Kabaev
b792e03079 Do not bother walking mount point vnode list just to calculate
the number of vnodes. Use precomputed mp->mnt_nvnodelistsize
value instead.
2003-11-01 04:36:50 +00:00
Poul-Henning Kamp
8b285b9088 Remember to check the DE_WHITEOUT flag in the case where a cloned
device is hidden by a devfs(8) rule.

Spotted by:	 Adam Nowacki <ptnowak@bsk.vectranet.pl>
2003-10-20 15:08:10 +00:00
Poul-Henning Kamp
7e8766a940 When a driver successfully created a device on demand, we can directly
pick up the DEVFS inode number from the dev_t and find our directory
entry from that, we don't need to scan the directory to find it.

This also solves an issue with on-demand devices in subdirectories.

Submitted by:	cognet
2003-10-20 07:04:09 +00:00
Maxime Henrion
6fb826df1c Remove debug printf(). 2003-10-19 14:33:00 +00:00
Poul-Henning Kamp
01758670e9 Initialize b_iooffset before calling strategy 2003-10-18 19:48:21 +00:00
Poul-Henning Kamp
2c18019f14 DuH!
bp->b_iooffset (the spot on the disk), not bp->b_offset (the offset in
the file)
2003-10-18 14:10:28 +00:00
Poul-Henning Kamp
f14676dc6f Initialize b_offset before calling VOP_SPECSTRATEGY() 2003-10-18 11:08:33 +00:00
Poul-Henning Kamp
c87b01a0fd Initialize b_offset before calling VOP_STRATEGY/VOP_SPECSTRATEGY.
Remove various comments of KASSERTS and comments about B_PHYS which
does not apply anymore.
2003-10-18 11:06:15 +00:00
Poul-Henning Kamp
583b92e328 Convert some if(bla) panic("foo") to KASSERTS to improve grep-ability. 2003-10-18 09:32:39 +00:00
Poul-Henning Kamp
0023f61848 Introduce a new optional memberfunction for cdevsw, fdopen() which
passes the fdidx from VOP_OPEN down.

This is for all I know the final API for this functionality, but
the locking semantics for messing with the filedescriptor from
the device driver are not settled at this time.
2003-10-15 20:00:59 +00:00
Bruce Evans
201e0377ca Include <sys/mutex.h>. Don't depend on namespace pollution in <sys/vnode.h>.
Fixed a nearby style bug.  The include of vcoda.h used angle brackets and
was not used.
2003-10-05 07:44:45 +00:00
Jeff Roberson
4ab2c8bd52 - Check the XLOCK prior to inspecting v_data. 2003-10-05 06:44:53 +00:00
Jeff Roberson
055cfed702 - Check XLOCK prior to accessing v_data. 2003-10-05 06:43:30 +00:00
Jeff Roberson
7bfaa956e8 - Don't cache_purge() in cd9660_reclaim. vclean() does it for us so
this is redundant.
2003-10-05 02:45:36 +00:00
Jeff Roberson
9c695a2697 - Don't cache_purge() in *_reclaim routines. vclean() does it for us so
this is redundant.
2003-10-05 02:43:30 +00:00
Alan Cox
6caf7e9fa4 Synchronize access to a vm page's valid field using the containing
vm object's lock.
2003-10-04 23:37:38 +00:00
Jeff Roberson
0c31ea3b2d - Make proper use of the mntvnode_mtx. We do not need the loop label
because we do not drop the mntvnode_mtx.  If this code had ever executed
   and hit the loop condition it would have spun forever.
2003-10-04 13:16:54 +00:00
Jeff Roberson
c13c04a426 - Acquire the vnode interlock prior to droping the mntvnode_mtx. This does
not eliminate races where the vnode could be reclaimed and end up with
   a NULL v_data pointer but Giant is protecting us from that at the moment.
2003-10-04 12:52:37 +00:00
Alan Cox
10e9e2d1b9 Synchronize access to a page's valid field by using the lock from its
containing object.
2003-10-04 09:20:00 +00:00
Jeff Roberson
8b5905a47d - Remove the backtrace() call from the *_vinvalbuf() functions. Thanks to a
stack trace supplied by phk, I now understand what's going on here.  The
   check for VI_XLOCK stops us from calling vinvalbuf once the vnode has been
   partially torn down in vclean().  It is not clear that this would cause
   a problem.  Document this in nfs_bio.c, which is where the other two
   filesystems copied this code from.
2003-10-04 08:51:50 +00:00
Jacques Vidrine
8b7358ca43 Introduce a uiomove_frombuf helper routine that handles computing and
validating the offset within a given memory buffer before handing the
real work off to uiomove(9).

Use uiomove_frombuf in procfs to correct several issues with
integer arithmetic that could result in underflows/overflows.  As a
side-effect, the code is significantly simplified.

Add additional sanity checks when computing a memory allocation size
in pfs_read.

Submitted by:	rwatson  (original uiomove_frombuf -- bugs are mine :-)
Reported by:	Joost Pol <joost@pine.nl>  (integer underflows/overflows)
2003-10-02 15:00:55 +00:00
Robert Watson
309cd88432 Add a new column to the procfs map to hold the name of the mapped
file for vnode mappings.  Note that this uses vn_fullpath() and may
be somewhat unreliable, although not too unreliable for shared
libraries.  For non-vnode mappings, just print "-" for the field.

Obtained from:	TrustedBSD Projects
Sponsored by:	DARPA, AFRL, Network Associates Laboratories
2003-09-29 20:53:19 +00:00
Poul-Henning Kamp
25d6da1b5e forgot to remove static declaration of fdesc_poll() 2003-09-27 12:34:41 +00:00
Poul-Henning Kamp
f1cf3def78 fdesc_poll() called seltrue() to do the default thing, this is pointlessly
wrong when we have a default in vop_nopoll() which does the right thing.
2003-09-27 12:24:42 +00:00
Bruce Evans
67425e4678 Fixed some style bugs in previous commit. Mainly, forward-declare
struct msdosfsmount so that this file has the same prerequisites as
it used to.  The new prerequistite was a meta-style bug.  It required
many style bugs (unsorted includes ...) elsewhere.

Formatted prototypes in KNF.  Resisted urge to sort all the prototypes,
to minimise differences with NetBSD.  (NetBSD has reformatted the
prototypes but has not sorted them and  still uses __P(()).)
2003-09-27 01:18:27 +00:00
Max Khon
c4f02a891f - Support for multibyte charsets in LIBICONV.
- CD9660_ICONV, NTFS_ICONV and MSDOSFS_ICONV kernel options
(with corresponding modules).
- kiconv(3) for loadable charset conversion tables support.

Submitted by:	Ryuichiro Imura <imura@ryu16.org>
2003-09-26 20:26:25 +00:00
Tim J. Robbins
aa808a7fa6 Allow the [, ], and = characters in non-8.3 filenames since they
are allowed by Windows (ref: MS KB article 120138).

XXX From my reading of the CIFS specification, it's not clear that
clients need to validate filenames at all.

PR:		57123
Submitted by:	Paul Coucher
MFC after:	1 month
2003-09-26 12:11:08 +00:00
Jeff Roberson
ce1fb23146 - Remove interlock protection around VI_XLOCK. The interlock is not
sufficient to guarantee that this race is not hit.  The XLOCK will likely
   have to be redesigned due to the way reference counting and mutexes work
   in FreeBSD.  We currently can not be guaranteed that xlock was not set
   and cleared while we were blocked on the interlock while waiting to check
   for XLOCK.  This would lead us to reference a vnode which was not the
   vnode we requested.
 - Add a backtrace() call inside of INVARIANTS in the hopes of finding out if
   this condition is ever hit.  It should not, since we should be retaining
   a reference to the vnode in these cases.  The reference would be sufficient
   to block recycling.
2003-09-19 23:37:49 +00:00