Commit Graph

1341 Commits

Author SHA1 Message Date
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
Tim J. Robbins
5f39b226ce Move an overly verbose message under #ifdef CODA_VERBOSE. 2003-09-13 01:13:56 +00:00
Tim J. Robbins
e1d237ec05 Move an annoying printf() call that gets triggered every time an
operation is interrupted (with ^C or ^Z) under CODA_VERBOSE.
2003-09-10 01:41:15 +00:00
Tim J. Robbins
d14e51c95c Add support for the Coda 6.x venus<->kernel interface. This extends
FIDs to be 128-bits wide and adds support for realms.

Add a new CODA_COMPAT_5 option, which requests support for the old
Coda 5.x interface instead of the new one.

Create a new coda5.ko module that supports the 5.x interface, and make
the existing coda.ko module use the new 6.x interface. These modules
cannot both be loaded at the same time.

Obtained from:	Jan Harkes & the coda-6.0.2 distribution,
		NetBSD (drochner) (CODA_COMPAT_5 option).
2003-09-07 07:43:10 +00:00
Marcel Moolenaar
fccf82902d The valid field in struct vm_page can be of type unsigned long when
32K pages are selected. In spec_getpages() change the printf format
specifier and add an explicit cast so that we always print the field
as a long type.
2003-08-28 01:52:14 +00:00
Alan Cox
49dc7ac17d Use the requested page's object field instead of the vnode's. In some
cases, the vnode's object field is not initialized leading to a NULL
pointer dereference when the object is locked.

Tested by:	rwatson
2003-08-22 17:50:32 +00:00
Dag-Erling Smørgrav
134ce0f9cc Add pfs_visible() checks to pfs_getattr() and pfs_getextattr(). This
also fixes pfs_access() since it relies on VOP_GETATTR() which will call
pfs_getattr().  This prevents jailed processes from discovering the
existence, start time and ownership of processes outside the jail.

PR:		kern/48156
2003-08-19 10:26:41 +00:00
John Baldwin
d49ebea58c Spell the name of the lock right in addition to getting the type right.
Submitted by:	Kim Culhan <kimc@w8hd.org>
2003-08-18 19:23:01 +00:00
John Baldwin
cda369cac4 The allproc lock is a sx lock, not a mutex, so fix the assertion. This
asserts that the sx lock is held, but does not specify if the lock is held
shared or exclusive, thus either type of lock satisfies the assertion.
2003-08-18 18:02:33 +00:00
Dag-Erling Smørgrav
653fae1761 Rework pfs_iterate() a bit to eliminate a bug related to process
directories.  Previously, pfs_iterate() would return -1 when it
reached the end of the process list while processing a process
directory node, even if the parent directory contained further nodes
(which is the case for the linprocfs root directory, where the process
directory node is actually first in the list).  With this patch,
pfs_iterate() will continue to traverse the parent directory's node
list after exhausting the process list (as was the intention all
along).  The code should hopefully be easier to read as well.

While I'm here, have pfs_iterate() assert that the allproc lock is
held.
2003-08-18 13:36:09 +00:00
Poul-Henning Kamp
29796304f8 Do not call VOP_BMAP() on our own vnodes.
It is particularly silly when all it does is a minor piece of math.
2003-08-17 23:00:30 +00:00
Robert Watson
946e86b7e1 Add p_candebug() check to access a process map file in procfs; limit
access to map information for processes that you wouldn't otherwise
have debug rights on.

Tested by:	bms
2003-08-14 15:26:44 +00:00
Tom Rhodes
c98a31cad3 Add a '-M mask' option so that users can have different
masks for files and directories.  This should make some
of the Midnight Commander users happy.

Remove an extra ')' in the manual page.

PR:		35699
Submitted by:	Eugene Grosbein <eugen@grosbein.pp.ru> (original version)
Tested by:	simon
2003-08-12 20:06:56 +00:00
John Baldwin
8b149b5131 Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort.  In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by:	bde (kern_ktrace.c)
2003-08-07 15:04:27 +00:00
Poul-Henning Kamp
291faa1677 Don't drop giant around ->d_strategy(), too much code explodes. 2003-08-06 06:49:18 +00:00
Poul-Henning Kamp
f4a3d9da6e Only drop Giant around the drivers ->d_strategy() if the buffer is not
marked to prevent this.
2003-08-05 06:43:56 +00:00
Poul-Henning Kamp
a8d43c90af Add a "int fd" argument to VOP_OPEN() which in the future will
contain the filedescriptor number on opens from userland.

The index is used rather than a "struct file *" since it conveys a bit
more information, which may be useful to in particular fdescfs and /dev/fd/*

For now pass -1 all over the place.
2003-07-26 07:32:23 +00:00
Tim J. Robbins
c8db6734e0 Revise and improve ntfs_subr.c 1.30: read only a single cluster at a time
in ntfs_writentvattr_plain and ntfs_readntvattr_plain, and purge the boot
block from the buffer cache if isn't exactly one cluster long. These two
changes work around the same buffer cache bug that ntfs_subr.c 1.30 tried
to, but in a different way. This may decrease throughput by reading smaller
amounts of data from the disk at a time, but may increase it by avoiding
bogus writes of clean buffers.
Problem (re)reported by Karel J. Bosschaart on -current.
2003-07-26 02:21:49 +00:00
Peter Wemm
7d6207b7dd size_t != int. Make this compile on 64 bit platforms (eg: amd64).
Also, "u_short value; if (value > 0xffff)" can never be true.
2003-07-24 01:59:18 +00:00
Tom Rhodes
3c01bab8a3 If bread() returns a zero-length buffer, as can happen after a
failed write, return an error instead of looping forever.

PR:		37035
Submitted by:	das
2003-07-03 14:54:47 +00:00
Tim J. Robbins
ae620d4480 XXX Copy workaround from UFS: open device for write access even if
the user requests a read-only mount. This is necessary because we
don't do the VOP_OPEN again if they upgrade a read-only mount to
read-write.

Fixes lockup when creating files on msdosfs mounts that have been
mounted read-only then upgraded to read-write. The exact cause of
the lockup is not known, but it is likely to be the kernel getting
stuck in an infinite loop trying to write dirty buffers to a device
without write permission.

Reported/tested by andreas, discussed with phk.
2003-06-29 03:05:59 +00:00
Tom Rhodes
c2f95f6688 Fix a bug where a truncate operation involving truncate() or ftruncate() on
an MSDOSFS file system either failed, silently corrupted the file, or
sometimes corrupted the neighboring file.

PR:		53695
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my> (original version)
MFC:		3 days
2003-06-27 15:46:38 +00:00
John-Mark Gurney
4119b6e581 change dev_t to struct cdev * to match ufs. This fixes fstat for cd9660
and msdosfs.

Reviewed by:	bde
2003-06-24 22:11:20 +00:00
Poul-Henning Kamp
3b6d965263 Add a f_vnode field to struct file.
Several of the subtypes have an associated vnode which is used for
stuff like the f*() functions.

By giving the vnode a speparate field, a number of checks for the specific
subtype can be replaced simply with a check for f_vnode != NULL, and
we can later free f_data up to subtype specific use.

At this point in time, f_data still points to the vnode, so any code I
might have overlooked will still work.
2003-06-22 08:41:43 +00:00