Doug Rabson [Sun, 24 May 2009 13:22:00 +0000 (13:22 +0000)]
Make sure we feed 32bit align memory to nfsm_dissect otherwise we will fault
on platforms with strict alignment requirements. In particular, this fixes the
problems with the new RPC transport on the arm platform.
Note: this adds yet another copy of nfs_realign(). I will attempt to refactor
after NFS_LEGACYRPC is removed.
The advisory lock may be activated or activated and removed during the
sleep waiting for conditions when the lock may be granted.
To prevent lf_setlock() from accessing possibly freed memory, add reference
counting to the struct lockf_entry. Bump refcount around the sleep.
Make lf_free_lock() return non-zero when structure was freed, and use
this after the sleep to return EINTR to the caller. The error code might
need a clarification, but we cannot return success to usermode, since
the lock is not owned anymore.
In lf_advlockasync(), recheck for doomed vnode after the state->ls_lock
is acquired. In the lf_purgelocks(), assert that vnode is doomed and set
*statep to NULL before clearing ls_pending list. Otherwise, we allow for
the thread executing lf_advlockasync() to put new pending entry after
state->ls_lock is dropped in lf_purgelocks().
Ed Schouten [Sun, 24 May 2009 12:32:03 +0000 (12:32 +0000)]
Block when initially opening a TTY multiple times.
In the original MPSAFE TTY code, I changed the behaviour by returning
EBUSY. I thought this made more sense, because it's basically a race to
see who gets the TTY first.
It turns out this is not a good change, because it also causes EBUSY to
be returned when another process is closing the TTY. This can happen
during startup, when /etc/rc (or one of its children) is still busy
draining its data and /sbin/init is attempting to open the TTY to spawn
a getty.
Doug Rabson [Sun, 24 May 2009 11:37:10 +0000 (11:37 +0000)]
Increase the number of available file descriptors to 64. This fixes the
reported zfsboot problems for systems where more than seven drives are part
of ZFS pools.
Rick Macklem [Sun, 24 May 2009 03:22:49 +0000 (03:22 +0000)]
Fix the experimental nfsv4 client so that it works for the
case of a kerberized mount without a host based principal
name. This will only work for mounts being done by a user
other than root. Support for a host based principal name
will not work until proposed changes to the rpcsec_gss part
of the krpc are committed. It now builds for "options KGSSAPI".
Rick Macklem [Sun, 24 May 2009 01:18:56 +0000 (01:18 +0000)]
Modify nfsd.c to add support for the experimental nfs server.
This includes the addition of a new flag "-4" that will force
use of the experimental server with nfsv4 support in it. This
commit also adds two new man pages to the repository that are
NFSv4 specific. One describes the file used by the server to
restart nfsv4 services safely. The other is a brief overview
of nfsv4 and its setup.
Bjoern A. Zeeb [Sat, 23 May 2009 22:57:49 +0000 (22:57 +0000)]
Even if not entirely style clean the heavy nesting of the various
vimage options along with all the defines made things really hard to
read and get right; thus add comments for the #else/#endif cases.
Alan Cox [Sat, 23 May 2009 22:05:14 +0000 (22:05 +0000)]
pmap_enter() *must* set PG_WRITEABLE on the given page if it creates a
mapping that permits write access. Otherwise, pmap_remove_write() will not
remove write access from any of the page's mappings.
Marko Zec [Sat, 23 May 2009 21:43:44 +0000 (21:43 +0000)]
V_irtualize the if_clone framework, thus allowing for clonable ifnets
to optionally have overlapping unit numbers if attached in different
vnets.
At this stage if_loop is the only clonable ifnet class that has been
extended to allow for such overlapping allocation of unit numbers, i.e.
in each vnet it is possible to have a lo0 interface. Other clonable ifnet
classes remain to operate with traditional semantics, i.e. each instance
of a clonable ifnet will be assigned a globally unique unit number,
regardless in which vnet such an ifnet becomes instantiated.
While here, garbage collect unused _lo_list field in struct vnet_net,
as well as improve indentation for #defines in sys/net/vnet.h.
The layout of struct vnet_net has changed, therefore bump
__FreeBSD_version.
This change has no functional impact on nooptions VIMAGE kernel builds.
Alan Cox [Sat, 23 May 2009 18:44:26 +0000 (18:44 +0000)]
Give pmap_enter()'s third parameter the same name that it has on amd64 and
i386. Otherwise, my next to last commit (r192628) to this file doesn't
actually compile.
Alan Cox [Sat, 23 May 2009 18:33:22 +0000 (18:33 +0000)]
When a page is mapped for write access on a read fault, the PTE should be
configured to trap on a write access unless *all* of the page's dirty bits
are set.
Bjoern A. Zeeb [Sat, 23 May 2009 17:02:30 +0000 (17:02 +0000)]
For UDP with introducing the UDP control block, the uma zone had to
be named "udp_inpcb" to avoid a naming conflict with tcp[1].
For consistency rename the uma zone for TCP from "inpcb" to "tcp_inpcb".
Bjoern A. Zeeb [Sat, 23 May 2009 16:51:13 +0000 (16:51 +0000)]
Implement UDP control block support.
So far the udp_tun_func_t had been (ab)using inp_ppcb for udp in kernel
tunneling callbacks. Move that into the udpcb and add a field for flags
there to be used by upcoming changes instead of sticking udp only flags
into in_pcb flags2.
Bump __FreeBSD_version for ports to detect it and because of vnet* struct
size changes.
Bjoern A. Zeeb [Sat, 23 May 2009 16:42:38 +0000 (16:42 +0000)]
Add sysctls to toggle the behaviour of the (former) IPSEC_FILTERTUNNEL
kernel option.
This also permits tuning of the option per virtual network stack, as
well as separately per inet, inet6.
The kernel option is left for a transition period, marked deprecated,
and will be removed soon.
Initially requested by: phk (1 year 1 day ago)
MFC after: 4 weeks
Rafal Jaworowski [Sat, 23 May 2009 13:23:46 +0000 (13:23 +0000)]
Fix cryptodev UIO creation.
Cryptodev uses UIO structure do get data from userspace and pass it to
cryptographic engines. Initially UIO size is equal to size of data passed to
engine, but if UIO is prepared for hash calculation an additional small space
is created to hold result of operation.
While creating space for the result, UIO I/O vector size is correctly
extended, but uio_resid field in UIO structure is not modified.
As bus_dma code uses uio_resid field to determine size of UIO DMA mapping,
resulting mapping hasn't correct size. This leads to a crash if all the
following conditions are met:
1. Hardware cryptographic accelerator writes result of hash operation
using DMA.
2. Size of input data is less or equal than (n * PAGE_SIZE),
3. Size of input data plus size of hash result is grather than
(n * PAGE_SIZE, where n is the same as in point 2.
This patch fixes this problem by adding size of the extenstion to uio_resid
field in UIO structure.
Submitted by: Piotr Ziecik kosmo ! semihalf dot com
Reviewed by: philip
Obtained from: Semihalf
Alan Cox [Sat, 23 May 2009 07:58:56 +0000 (07:58 +0000)]
Preset the modified bit in the PTE when pmap_enter() is called during a
write fault or while wiring a mapping that must support write access.
In general, this change should reduce the number of traps that occur for
the purpose of setting the modified bit. More specifically, this change
should prevent traps while holding locks in a sysctl handler. See
kern/kern_sysctl.c revisions 1.168 and 1.195 (svn r192160) for further
details.
Rick Macklem [Sat, 23 May 2009 00:40:17 +0000 (00:40 +0000)]
Fix the rpc_gss_secfind() call in nfs_commonkrpc.c so that
the code will build when "options KGSSAPI" is specified
without requiring the proposed changes that add host based
initiator principal support. It will not handle the case where
the client uses a host based initiator principal until those
changes are committed. The code that uses those changes is
#ifdef'd notyet until the krpc rpcsec_changes are committed.
Bjoern A. Zeeb [Sat, 23 May 2009 00:07:55 +0000 (00:07 +0000)]
It seems this file was ignored by MRT, rnh locking changes and new-arpv2.
So let the V_irtualization people finally make the disabled debugging code
compile again.
MFC after: 2 weeks
X-MFC: MRT and adapt rnh locking
Rick Macklem [Fri, 22 May 2009 23:22:56 +0000 (23:22 +0000)]
Change the sysctl_base argument to svcpool_create() to NULL for
client side callbacks so that leaf names are not re-used,
since they are already being used by the server.
Bjoern A. Zeeb [Fri, 22 May 2009 23:03:15 +0000 (23:03 +0000)]
If including vnet.h one has to include opt_route.h as well. This is
because struct vnet_net holds the rt_tables[][] for MRT and array size
is compile time dependent. If you had ROUTETABLES set to >1 after
r192011 V_loif was pointing into nonsense leading to strange results
or even panics for some people.
Marko Zec [Fri, 22 May 2009 22:09:00 +0000 (22:09 +0000)]
Introduce the if_vmove() function, which will be used in the future
for reassigning ifnets from one vnet to another.
if_vmove() works by calling a restricted subset of actions normally
executed by if_detach() on an ifnet in the current vnet, and then
switches to the target vnet and executes an appropriate subset of
if_attach() actions there.
if_attach() and if_detach() have become wrapper functions around
if_attach_internal() and if_detach_internal(), where the later
variants have an additional argument, a flag indicating whether a
full attach or detach sequence is to be executed, or only a
restricted subset suitable for moving an ifnet from one vnet to
another. Hence, if_vmove() will not call if_detach() and if_attach()
directly, but will call the if_detach_internal() and
if_attach_internal() variants instead, with the vmove flag set.
While here, staticize ifnet_setbyindex() since it is not referenced
from outside of sys/net/if.c.
Also rename ifccnt field in struct vimage to ifcnt, and do some minor
whitespace garbage collection where appropriate.
This change should have no functional impact on nooptions VIMAGE kernel
builds.
Rick Macklem [Fri, 22 May 2009 16:41:33 +0000 (16:41 +0000)]
Change the reboot panic that would have occurred if clientid
numbers wrapped around to a printf() warning of a possible
DOS attack, in the experimental nfsv4 server.
Rick Macklem [Fri, 22 May 2009 15:08:12 +0000 (15:08 +0000)]
Modify the mount handling code in the experimental nfs client to
use the newer nmount() style arguments, as is used by mount_nfs.c.
This prepares the kernel code for the use of a mount_nfs.c with
changes for the experimental client integrated into it.
Rick Macklem [Fri, 22 May 2009 15:01:47 +0000 (15:01 +0000)]
Change the code in the experimental nfs client to avoid flushing
writes upon close when a write delegation is held by the client.
This should be safe to do, now that nfsv4 Close operations are
delayed until ncl_inactive() is called for the vnode.
Rick Macklem [Fri, 22 May 2009 14:53:26 +0000 (14:53 +0000)]
Fix the comment in sys/fs/nfs/nfs.h to correctly reflect the
current use of the R_xxx flags. This changed when the
NFS_LEGACYRPC code was removed from the subsystem.
Robert Watson [Fri, 22 May 2009 12:35:12 +0000 (12:35 +0000)]
Remove the unmaintained University of Michigan NFSv4 client from 8.x
prior to 8.0-RELEASE. Rick Macklem's new and more feature-rich NFSv234
client and server are replacing it.
Bjoern A. Zeeb [Fri, 22 May 2009 09:59:34 +0000 (09:59 +0000)]
Add privileges for Capi4BSD to control:
- controller reset/firmware loading.
- controller level tracing and tracing of capi messages of applications
running with different user credentials.
Bruce M Simpson [Thu, 21 May 2009 18:05:17 +0000 (18:05 +0000)]
Pullup from p4 tip:
* Fix MLDv2 general query timer (fallout from automated refactoring).
* Refactor MLDv1 timer.
MLDv2 query processing is now working.
When man pages are formatted in UTF-8, .Fl is encoded as U+2212 "MINUS
SIGN" instead of U+002D "HYPHEN-MINUS". This is unfortunate for two
reasons: 1) this is not the character which is actually used on the
command line, and 2) it makes it impossible to search a man page for a
specific command-line option.
This patch fixes this, but there are other unresolved issues, such as
confusion between -, \- and hy: while the latter is always (and only)
used for hyphenation, both - and \- are used for negation and
subtraction, and \- is used for command-line options and sometimes
also for parenthesis. IMHO, the correct Unicode characters are:
- hyphenation: either U+2010 or U+00AD, most likely the former (the
latter is the so-called soft hyphen, used to indicate a point at
which a text processor is allowed to hyphenate a word)
- negation and subtraction: U+2212
- parenthesis: in English, U+2214, with spaces suppressed before and
after; in some others (such as Norwegian), U+2213 with spaces
retained.
- command-line options: U+002D, because that is what is actually used
on the command line.
However, fixing this would require extensive modifications to (at least)
the doc and man macro sets...
Andrew Thompson [Thu, 21 May 2009 17:42:32 +0000 (17:42 +0000)]
Add a driver for the AVR32 series USB Device Controller. Not hooked up as
FreeBSD does not yet support this platform but it makes it easier to stay in
sync.
Andrew Thompson [Thu, 21 May 2009 17:39:21 +0000 (17:39 +0000)]
Improve device mode (gadget) stall handling.
Some hardware easily comes out of sync with regard to whether the current or
the next control transfer should be stalled, if a stall command is always
issued before receiving the SETUP packet. After this patch the stall command
will only be issued when a transfer should actually be stalled.
Rick Macklem [Thu, 21 May 2009 16:27:47 +0000 (16:27 +0000)]
Modify src/etc/mtree/BSD.include.dist and src/include/Makefile
so that the .h files in src/sys/fs/nfs will be installed under
/usr/include/fs/nfs. This will allow the following utilities to
build, once additions and changes for the experimental nfs subsystem
are committed:
usr.sbin/mountd - Once modified to add support for the
experimental nfs subsystem.
ur.sbin/nfsstat - Once modified to add support for the
experimental nfs subsystem.
usr.sbin/nfscbd - The client side callback daemon for NFSv4.
usr.sbin/nfsuserd - The NFSv4 user/group name<->uid/gid mapping daemon.
usr.sbin/nfsdumpstate - The NFSv4 utility for dumping open/lock state.
usr.sbin/nfsrevoke - The sysadmin command for revoking NFSv4 state.
Ed Schouten [Thu, 21 May 2009 16:19:54 +0000 (16:19 +0000)]
Add a new sysctl: kern.tty_inq_flush_secure.
When enabled all TTY input queue buffers are zeroed when flushing or
closing the TTY. Because TTY input queues are also used to store filled
in passwords, this may be an interesting switch to enable for security
minded people.
1) Add a sysctl that will say what type of PHYs exist on the card.
2) Fix a bug that occurs when an AEL 2005 PHY resets without a transciever
in the card.
3) Unify the PHY link detection code.
Modified the attach and detach routines to handle bringing ports up
and down more cleanly. This addresses a problem where if we have the
link flap during boot the driver would lock up the system.
Attilio Rao [Thu, 21 May 2009 13:22:07 +0000 (13:22 +0000)]
Move the M_WAITOK flag in notify() into an M_NOWAIT one in order to match
the behaviour alredy present with the further malloc() call in
devctl_notify().
This fixes a bug in the CAM layer where the camisr handler finished to
call camperiphfree() (and subsequently destroy_dev() resulting in a new
dev notify) while the xpt lock is held.
John Baldwin [Thu, 21 May 2009 12:36:40 +0000 (12:36 +0000)]
Largely revert the earlier change to use a single CCB for the RAID recovery
thread. Multiple RAID events in quick succession can cause an additional
bus rescan to be scheduled before an earlier scan has completed. In this
case the driver was attempting to use the same CCB storage for two requests.