Matthew Dillon [Sat, 21 Aug 2010 21:26:12 +0000 (14:26 -0700)]
kernel - NFS server cleanup and xid atomic ops
* Use atomic_fetchadd_int() to allocate xid's in two places.
* NULL out rp fields and clear flags after freeing their pointers,
for safety.
Matthew Dillon [Sat, 21 Aug 2010 21:21:00 +0000 (14:21 -0700)]
HAMMER VFS - Minor iterator change for pid hash
* Make the iterator volatile so the compiler only loads it once.
Matthew Dillon [Sat, 21 Aug 2010 21:15:41 +0000 (14:15 -0700)]
HAMMER VFS - Add debugging for overlapping buffer issue
* Add debug flags to display information that may be useful when
diagnosing overlapping buffers.
Set vfs.hammer.debug_general=163840 (0x28000) to generate
the debug data.
Matthew Dillon [Sat, 21 Aug 2010 21:14:16 +0000 (14:14 -0700)]
kernel - clarify comment in nestio code
* Clarify comments on the use of a counter to determine when the
last nested I/O is finished.
Matthew Dillon [Sat, 21 Aug 2010 21:12:30 +0000 (14:12 -0700)]
kernel - minor flags coding change
* Use |= instead of =. The related structure was bzero'd so the effect
is the same but this reduces potential confusion.
Matthew Dillon [Sat, 21 Aug 2010 21:00:49 +0000 (14:00 -0700)]
kernel - Fix system lockup w/ kqueue based select/poll due to dup2()
* dup2() was not calling knote_fdclose() on the original descriptor being
replaced
* fdfree() (called by exit) was not cleaning out knotes either, though
exit*() probably took care of it already when it closed the descriptors.
* Assert that a file has no knotes on the last fdrop().
Reported-by: everyone + lentferj + alexh + swildner + Studbolt
Sascha Wildner [Sat, 21 Aug 2010 19:07:22 +0000 (21:07 +0200)]
Move the arp(4) manual page to share/man, too.
Sascha Wildner [Sat, 21 Aug 2010 19:05:02 +0000 (21:05 +0200)]
Move the random(4) manual page to share/man.
Sascha Wildner [Sat, 21 Aug 2010 19:03:38 +0000 (21:03 +0200)]
hotplugd(8): Remove unnecessary SRCS.
Alex Hornung [Sat, 21 Aug 2010 16:33:27 +0000 (17:33 +0100)]
dm_target_crypt - fix logic for xts support
Alex Hornung [Sat, 21 Aug 2010 14:56:38 +0000 (15:56 +0100)]
crypto.[49] - update for CRYPTO_AES_{XTS,CTR}
Alex Hornung [Sat, 21 Aug 2010 14:37:50 +0000 (15:37 +0100)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly
Alex Hornung [Sat, 21 Aug 2010 14:35:57 +0000 (15:35 +0100)]
crypto - fix crypto_getfeat
* CRK_DH_COMPUTE_KEY was being skipped in crypto_getfeat, as it is ==
CRK_ALGORITHM_MAX.
Sascha Wildner [Sat, 21 Aug 2010 14:02:07 +0000 (16:02 +0200)]
LINT: Why not just keep it sorted?
Alex Hornung [Sat, 21 Aug 2010 13:36:09 +0000 (14:36 +0100)]
aesni - printf -> kprintf for DEBUG
Alex Hornung [Sat, 21 Aug 2010 13:16:29 +0000 (14:16 +0100)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly
Alex Hornung [Sat, 21 Aug 2010 12:48:24 +0000 (13:48 +0100)]
dm_target_crypt - Enable support for AES-XTS
Alex Hornung [Sat, 21 Aug 2010 12:25:03 +0000 (13:25 +0100)]
padlock - Rework locking
* Change lockmgr to spinlock (FreeBSD used to use rwlocks for this),
since there's no blocking in the locked sections.
* Fix several bugs where previously a shared lock was held although an
exclusive lock was required.
* Add a missing unlock in padlock_detach.
Alex Hornung [Sat, 21 Aug 2010 12:17:11 +0000 (13:17 +0100)]
aesni - Bind into build system & LINT
Alex Hornung [Sat, 21 Aug 2010 12:16:52 +0000 (13:16 +0100)]
aesni - Rename amd64 -> x86_64
Alex Hornung [Sat, 21 Aug 2010 12:11:30 +0000 (13:11 +0100)]
aesni - Port to DragonFly
* Please note that this is completely *UNTESTED*
Alex Hornung [Sat, 21 Aug 2010 11:51:19 +0000 (12:51 +0100)]
aesni - Import verbatim from FreeBSD
Alex Hornung [Sat, 21 Aug 2010 12:58:23 +0000 (13:58 +0100)]
test - Add crypto(dev) tests from OpenBSD
* Obtained-from: OpenBSD
Alex Hornung [Sat, 21 Aug 2010 11:35:19 +0000 (12:35 +0100)]
cryptodev - Allow software crypto
* Allow using software crypto via cryptodev if the sysctl
kern.cryptodevallowsoft is set to 1.
* This allows to run a bunch of crypto tests and verify test vectors
without having hardware acceleration.
Alex Hornung [Sat, 21 Aug 2010 10:51:38 +0000 (11:51 +0100)]
crypto - Update crypto for AES XTS and CTR
* Sync a bit up with OpenBSD, adding 'reinit' and 'ivsize' to the xform
structure.
* Add support for AES-XTS and AES-CTR.
Obtained-from: OpenBSD
Alex Hornung [Sat, 21 Aug 2010 10:46:17 +0000 (11:46 +0100)]
padlock - Properly align data
* Most parameters to the xcrypt instruction need to be aligned to 16
bytes. So far we haven't been aligning some of the data such as the
key, iv and control structure. Refer to the "VIA PadLock Programming
Guide" for more details.
* Address this by allocating a bit more
space and setting stuff up at 16-byte boundaries and ensuring gcc
aligns the whole structure 16-bytish. While this wastes some memory,
it is negligible.
* This fixes the issue with encryption and decryption with padlock
causing general protection faults.
Reported-by: Jan Lentfer (lentferj@)
Sascha Wildner [Sat, 21 Aug 2010 11:43:23 +0000 (13:43 +0200)]
man9/Makefile: Sort alphabetically.
Alex Hornung [Sat, 21 Aug 2010 06:49:27 +0000 (07:49 +0100)]
cryptosoft - Fix useless compression detection
* If the result of the compression has the same size as the input, it's
also useless; not only when it's bigger.
* This seems to fix several issues with consumers that would send the
data out without noting that compression was used.
Obtained-from: FreeBSD
Alex Hornung [Sat, 21 Aug 2010 06:17:54 +0000 (07:17 +0100)]
dm_target_crypt - Fix compatibility with Linux
* The sector number that Linux' dm-crypt passes to its iv generators
is offset another -block_offset sectors, so that the actual sector
number is the one on the dm device, not the underlying device.
* Also fix the plain iv generator, which is supposed to be a "32-bit
little-endian version of the sector number"
* Now our dm_target_crypt can read Linux' crypt disks. This was tested
with an image using aes-cbc-essiv:sha256 and aes-cbc-plain.
Matthew Dillon [Fri, 20 Aug 2010 23:11:15 +0000 (16:11 -0700)]
kernel - Correct hex2key() in dm_crypt
* hex2key() was only scanning half the key, leaving the remainder
as garbage.
Matthew Dillon [Fri, 20 Aug 2010 21:52:58 +0000 (14:52 -0700)]
kernel - Fix iv sector mush in dm_target_crypt for offsets >= 1TB
* The linux code uses a 64-bit sector number for iv generation, so we
have to as well.
Alex Hornung [Fri, 20 Aug 2010 20:09:52 +0000 (21:09 +0100)]
padlock - get rid of __GNUCLIKE_ASM #ifdefs
* Remove the uses of __GNUCLIKE_ASM, as we don't define it and in any
case it only causes problems.
* If it wasn't defined, it would cause encryption to succeed but without
encrypting anything, potentially leaking private information. Since on
DragonFly this define doesn't exist, this would always be the case.
Reported-by: Jan Lentfer (lentferj@)
Dragonfly-bug: http://bugs.dragonflybsd.org/issue1638
Matthew Dillon [Fri, 20 Aug 2010 20:05:54 +0000 (13:05 -0700)]
kernel - opencrypto - optimize chained synchronous callbacks for soft crypto
* When a crypto operation is dispatched to a crypto thread and makes a
synchronous callback from that thread, and the callback function
dispatches a followup crypto as part of a chain, we ignore F_BATCH
and run the followup crypto directly.
Since we are already in a crypto thread there's no point dispatching
the followup crypto to another crypto thread.
Increases dm_crypt's essiv performance w/software crypto by 7%.
* Warning: The chain length for crypto operations with synchronous
callbacks should be limited to 2 or 3 to avoid blowing up the kernel's
thread stack.
Thomas Nikolajsen [Fri, 20 Aug 2010 19:47:44 +0000 (21:47 +0200)]
Fix minor mdoc(7) issues
* Start sentence on new line
* Delete white-space at end of line
Alex Hornung [Fri, 20 Aug 2010 17:44:48 +0000 (18:44 +0100)]
dm_target_crypt - rework ivgen magic, fix bug
* Add a forgotten crypto_freesession() in the destruction of the target.
* Change ivgen infrastructure to be more complete; each ivgen can now
have a ctor, a dtor and some private data.
* Change ESSIV ivgen to use its own crypto session.
* Change all the crypto stuff *not* to use an explicit key but rather
use the key with which they were initialized.
* Dispatch the actual data crypto from the ivgens, allowing the iv
generation to happen asynchronously.
Discussed-with: Matt Dillon (dillon@)
Alex Hornung [Fri, 20 Aug 2010 17:43:29 +0000 (18:43 +0100)]
crypto(9) - Fix argument type for crypto_freesession
Thomas Nikolajsen [Fri, 20 Aug 2010 18:56:26 +0000 (20:56 +0200)]
Fix LINT build
Antonio Huete Jimenez [Tue, 17 Aug 2010 16:59:50 +0000 (18:59 +0200)]
udevd - Change socket permissions so non-privileged users can access it.
Antonio Huete Jimenez [Tue, 17 Aug 2010 16:41:25 +0000 (18:41 +0200)]
udevd - Add an option to not daemonize udevd.
Antonio Huete Jimenez [Thu, 12 Aug 2010 12:19:34 +0000 (14:19 +0200)]
udev - Add unit serial number to the udev
dictionary when available.
Matthew Dillon [Fri, 20 Aug 2010 05:54:54 +0000 (22:54 -0700)]
HAMMER VFS - Throw away cached vnodes on stage2 mount failure
* Make sure all cached vnodes are thrown away before we destroy the mount
structure after a stage2 recovery failure.
Reported-by: Venkatesh Srinivas <vsrinivas@crater.dragonflybsd.org>
Matthew Dillon [Fri, 20 Aug 2010 05:38:11 +0000 (22:38 -0700)]
kernel - Fix intermediate value overflows in badjiosched() and bwillwrite()
* Fix overflows which can skew our write limiting heuristics and cause
the buffer daemons to flush too much dirty data at once.
Matthew Dillon [Fri, 20 Aug 2010 05:36:40 +0000 (22:36 -0700)]
HAMMER VFS - Limit pending writes when flushing undos
* Call hammer_io_limit_backlog() in the undo flush. We already call it
when flushing data and meta-data.
* Handles certain extreme cases where large amounts of undo data could
overwhelm dm_target_crypt.
Matthew Dillon [Fri, 20 Aug 2010 05:33:35 +0000 (22:33 -0700)]
kernel - limit running io writes during fsync
* The fsync code was queueing an unlimited number of BUF/BIOs while
flushing a file, which creates a very large write burden on the
system, read stalls due to locked buffers, and can also blow out
things like dm_target_crypt which must allocate side-buffers for
the data.
* Fixes kmalloc exhaustion panics with dm_crypt.
* Improves read performance under heavy write loads (e.g. blogbench).
Venkatesh Srinivas [Fri, 20 Aug 2010 05:08:38 +0000 (22:08 -0700)]
Fix !INVARIANTS build.
Fix-from: Matt Dillon.
Matthew Dillon [Fri, 20 Aug 2010 02:29:54 +0000 (19:29 -0700)]
kernel - dm_target_crypt - use CRYPTO_F_BATCH
* Allow crypto requests to be dispatched to multiple crypto support
threads instead of executing the operation synchronously.
* Greatly improves crypto performance on SMP boxes. 25MB/s -> 80MB/s on
my quad.
* Currently the ivgen code gets in the way because it must be executed
synchronously before the data crypto op can be initiated. Further
performance improvements are possible.
Matthew Dillon [Fri, 20 Aug 2010 02:29:03 +0000 (19:29 -0700)]
kernel - Add SMP support for software crypto driver
* Create a crypto thread for each cpu.
* Run the threads without the MP lock.
* Dispatch to the threads round-robin.
Matthew Dillon [Fri, 20 Aug 2010 02:07:57 +0000 (19:07 -0700)]
kernel - add kthread_create_cpu()
* Add a version of kthread_create() where the cpu can also be specified.
Venkatesh Srinivas [Fri, 20 Aug 2010 00:52:50 +0000 (17:52 -0700)]
Add a draft systimer(9) manpage.
Matthew Dillon [Thu, 19 Aug 2010 15:02:10 +0000 (08:02 -0700)]
HAMMER UTILITY - Fix buildworld issue w/ last commit
* Cockpit trouble.
Reported-by: swildner
Matthew Dillon [Wed, 18 Aug 2010 20:56:23 +0000 (13:56 -0700)]
HAMMER UTILITY - Fix seg-fault on corrupt blockmap during recovery
* Fix a seg-fault which occurs when the recover directive hits a bad
blockmap entry.
Reported-by: "Miro Svetlik" <miro@svetlik.be>
Matthew Dillon [Wed, 18 Aug 2010 19:22:49 +0000 (12:22 -0700)]
kernel - Fix possible race in syncache
* syncache_timer_handler() can block while dropping a syncache entry,
potentially causing the next pointer it uses in its list iteration
to become stale.
* Use a list marker to keep tabs on the list position instead of using
a next pointer.
* Remove critical sections, callouts do not preempt and syncache
routines can only be entered from protocol threads or callouts.
* Document the callout code as not preempting other threads.
Reported-by: Peter Avalos <pavalos@theshell.com>
Matthew Dillon [Wed, 18 Aug 2010 18:50:56 +0000 (11:50 -0700)]
kernel - Fix excessive mbuf use in nfs_realign()
* nfs_realign() was calling m_copyback() which itself uses the deprecated
m_getclr(), and m_getclr() only allocates non-cluster mbufs.
This caused nfs_realign() to use an excessive number of mbufs and can
exhaust the mbuf pool on systems with small amounts of memory.
Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
Matthew Dillon [Wed, 18 Aug 2010 15:10:09 +0000 (08:10 -0700)]
HAMMER Utility - Ignore additional failure cases during recover
* Ignore bad volume specifications in data offsets during a recover
operation.
Reported-by: "Miro Svetlik" <miro@svetlik.be>
Matthew Dillon [Wed, 18 Aug 2010 00:52:59 +0000 (17:52 -0700)]
libkvm - kvm_get_swapinfo - fix memory leak in last commit
* Fix a memory leak
Matthew Dillon [Wed, 18 Aug 2010 00:44:10 +0000 (17:44 -0700)]
libkvm - Adjust kvm_getswapinfo() to use the new vm.swap_info_array sysctl
* kvm_getswapinfo() attempts to use the new sysctl and if it fails, or
if the kvm is operating on a kernel core file, reverts to the namelist.
Matthew Dillon [Wed, 18 Aug 2010 00:43:02 +0000 (17:43 -0700)]
kernel - Implement vm.swap_info_array sysctl
* Track swap usage on a per-device basis
* Implement the vm.swap_info_array sysctl to retrieve the array.
Matthew Dillon [Tue, 17 Aug 2010 16:56:28 +0000 (09:56 -0700)]
kernel - add vm.swap_size sysctl
* Add vm.swap_size sysctl to complement vm.swap_anon_use and
vm.swap_cache_use.
Requested-by: Carlos Olmedo Escobar
Stathis Kamperis [Mon, 16 Aug 2010 17:42:49 +0000 (20:42 +0300)]
awk: Switch to awk
20100523
Stathis Kamperis [Mon, 16 Aug 2010 17:42:24 +0000 (20:42 +0300)]
awk: Tweak local patch to apply cleanly to new awk
Stathis Kamperis [Mon, 16 Aug 2010 17:19:10 +0000 (20:19 +0300)]
awk: Remove local patch, it's fixed upstream
Stathis Kamperis [Mon, 16 Aug 2010 17:15:51 +0000 (20:15 +0300)]
awk: Add our README files
Stathis Kamperis [Mon, 16 Aug 2010 17:12:59 +0000 (20:12 +0300)]
Import of awk version
20100523
Sascha Wildner [Tue, 17 Aug 2010 13:55:50 +0000 (15:55 +0200)]
Fix some minor mdoc issues.
Sascha Wildner [Tue, 17 Aug 2010 12:52:50 +0000 (14:52 +0200)]
Make amdsmb(4) compilable into the kernel and add it to LINT.
Sascha Wildner [Tue, 17 Aug 2010 10:53:43 +0000 (12:53 +0200)]
Remove a debugging leftover (thus fixing LINT).
CLUSTERDEBUG is a kernel option. So it can't be defined again
unconditionally in the file.
Sascha Wildner [Tue, 17 Aug 2010 10:24:15 +0000 (12:24 +0200)]
Remove some leftovers from the iic upgrade via 'make upgrade'.
Matthew Dillon [Tue, 17 Aug 2010 06:49:16 +0000 (23:49 -0700)]
HAMMER Utility - Add catastrophic recovery feature
* hammer -f <devices> recover <empty_target_dir>
* Add a catastrophic recovery feature. A HAMMER filesystem image is
scanned (using the -f <blockdevs> specification). Any buffer which
looks like a B-Tree node is then sub-scanned for inode, directory, and
data records and the filesystem is reconstructed in the specified
target directory.
* The files and directories are initially named after the object id
and are renamed and moved as directory entries are found to resolve
the fragmentory information.
* File writes strip trailing 0's (data records are not limited to the
file EOF), but will properly truncate the file if/when the related
inode record is found.
* Currently no attempt is made to restore owner, group, file modes,
softlinks, or hardlinks (only one link will be restored).
TODO: Currently a valid volume header is required, but the only thing
we actually need from it is the vol_buf_beg field. This field
could be guessed or passed in on the command line in a future
update to the recovery code.
Matthew Dillon [Tue, 17 Aug 2010 06:18:09 +0000 (23:18 -0700)]
HAMMER VFS - Expand vfs.hammer.debug_io capabilities
* Add debugging capabilities which are able to distinguish IO requests
which are cached from IO requests which have to go to the device.
* vfs.hammer.debug_io bit 0 (i.e. the value 1) will use the new feature.
This is for debugging only.
Matthew Dillon [Tue, 17 Aug 2010 06:15:50 +0000 (23:15 -0700)]
HAMMER VFS - Add HAMMER_OFF_BAD
* Add a define for a hammer_off_t representing a bad offset.
Sascha Wildner [Tue, 17 Aug 2010 05:02:07 +0000 (07:02 +0200)]
Sync amdpm(4) with FreeBSD (and bring in amdsmb(4)).
Sascha Wildner [Tue, 17 Aug 2010 04:59:44 +0000 (06:59 +0200)]
powermng: Fix some printf -> kprintf.
Sascha Wildner [Tue, 17 Aug 2010 04:17:06 +0000 (06:17 +0200)]
Sync alpm(4) with FreeBSD.
Sascha Wildner [Tue, 17 Aug 2010 02:36:59 +0000 (04:36 +0200)]
Sync zoneinfo database with tzdata2010l from elsie.nci.nih.gov
africa: 8.27 -> 8.28
asia: 8.60 -> 8.61
* africa: Change Cairo's 2010 reversion to DST from the midnight between
September 8 and 9 to the midnight between September 9 and 10.
* asia: Change Gaza's 2010 return to standard time to the midnight
between August 10 and 11.
Sascha Wildner [Mon, 16 Aug 2010 17:39:23 +0000 (19:39 +0200)]
iicbus: Bring us closer to FreeBSD.
This is work in progress and I commit it so Dave Shao's Summer of Code
project can proceed.
Further commits will follow.
Taken-from: FreeBSD
Sascha Wildner [Mon, 16 Aug 2010 09:53:16 +0000 (11:53 +0200)]
man9/Makefile: Sort alphabetically.
Sascha Wildner [Mon, 16 Aug 2010 09:45:50 +0000 (11:45 +0200)]
Add a dsched(4) manual page.
dsched(9) will follow.
Submitted-by: alexh
Venkatesh Srinivas [Mon, 16 Aug 2010 06:29:10 +0000 (23:29 -0700)]
Add a draft mpipe(9) manpage explaining malloc pipelines.
Matthew Dillon [Mon, 16 Aug 2010 00:20:48 +0000 (17:20 -0700)]
kernel - revamp cluster_read API and improve performance
* Revamp the API to be much less confusing. Pass a minimum read ahead
based on the higher level uio length, and a maximum read ahead
based on the sequential heuristic. These combine together to determine
how much read-ahead to do.
For example if a program is doing random-reads with 1MB read() requests
the minreq will take precedence, whereas if the program is doing
sequential-reads of 8K the maxreq will take precedence.
The sequential heuristic currently maxes out at 128 * 16384 = 2MB.
* Introduce sysctl vfs.max_readahead instead of hardwiring the maximum
read-ahead. This defaults to 2MB which is big enough for just about
anything. Generally speaking this value should be larger than
your stripe width.
Note that currently the sequential heuristic also maxes out at 2MB so
you cannot go larger than 2MB.
* Also correct bugs that existed in the old cluster_read(), dramatically
improving performance on striped volumes with large chunk sizes (128K+)
and a large number of drives (3+).
* No change here but note that HAMMER will currently issue a minimum of
64K worth of read-ahead when accessing meta-data.
Matthew Dillon [Sun, 15 Aug 2010 23:19:19 +0000 (16:19 -0700)]
kernel - fix 64-bit build
* Fix minor cast issue for 64-bit kernel build.
Matthew Dillon [Sun, 15 Aug 2010 20:19:00 +0000 (13:19 -0700)]
HAMMER VFS - Limit queued I/O during flush
* Add sysctl vfs.hammer.limit_running_io and preset to a reasonable
value.
* The flusher was queueing all dirty buffers all at once, sometimes leading
to 80MB+ worth of I/O. This blew away dm_crypto (caused it to exceed
its malloc limit), and also results in generally poor kernel memory
behavior.
Limit the amount of in-flight I/O allowed during a flush to ~10MB or so,
which should be plenty.
Matthew Dillon [Sun, 15 Aug 2010 19:18:48 +0000 (12:18 -0700)]
systat - Add more spacing for the Load
* Adjust load display so three-digit loads do not crush the display
Matthew Dillon [Sun, 15 Aug 2010 18:57:53 +0000 (11:57 -0700)]
kernel - split the pbuf subsystem into two (kva and non-kva)
Most pbufs do not require kva reservations. Split the API to provide
pbufs without kva reservations out of a much larger pool of pbufs, fixing
deadlock issues with the DM subsystem.
Note in particular that the hammer reblocker can eat upwards of 5000 pbufs
when operating on multi-layered DM-based storage, which blows away the
256 pbufs normally available with kva reservations that the old API had.
* Getpbuf() / trypbuf() now return pbufs without KVA reservations.
* Add getpbuf_kva() and trypbuf_kva() to get pbufs with KVA reservations.
* Fixes pbuf deadlocks in the low level I/O subsystem, particularly DM
crypt, stripe, and mirror.
Matthew Dillon [Sun, 15 Aug 2010 15:24:13 +0000 (08:24 -0700)]
kernel - dm_crypt - Pre-zero control structures, disable B_HASBOGUS handling
* Don't take any chances, pre-zero control structures and make sure the
dmtc is completely initialized.
* Comment out the B_HASBOGUS read-decrypt bogus_page handling code.
It doesn't work yet and it turns out that it might not even be
necessary because the decrypter works on 512-byte sub blocks.
Matthew Dillon [Sun, 15 Aug 2010 15:20:37 +0000 (08:20 -0700)]
kernel - Add overlapping buffer test to the buffer cache
* Add a test for overlapping buffer in bgetvp().
* Add a sysctl vfs.check_buf_overlap which defaults to enabling the
check invasively. Overlapping buffer cache buffers can be deadly.
0 - disabled
1 - checked and reported
2 - checked and panic (invasive) (default)
Matthew Dillon [Sun, 15 Aug 2010 15:14:53 +0000 (08:14 -0700)]
HAMMER VFS - Fix over-enthusiastic cluster read
* The block device I/O was over-enthusiastic in calling cluster_read()
and could wind up creating the buffers of the wrong size which
would then overlap the address space later buffer requests for the
right size.
This could result in the corruption of large-data (64K) blocks,
usually causing a hammer reblock to fail with a CRC error but
not corrupting the actual filesystem on-media.
Meta data could not usually get corrupted by this unless the
cluster-read happened to cross a large-block (8MB) boundary.
* Particularly easy to reproduce with the dm_crypt module due to
crypt overheads.
* Fixed by disallowing read-aheads in the large-data zone (the only
zone which can contain a mix of 16K and 64K blocks), and ensuring
that any other cluster_read does not cross a large-block boundary.
Alex Hornung [Sun, 15 Aug 2010 12:24:24 +0000 (13:24 +0100)]
lvm - don't forget to include dlfcn.h
* dlfcn is needed for some of the functions used in toolcontext.c, so
include it on DragonFly, too.
Reported-by: Sascha Wildner (swildner@)
Alex Hornung [Sun, 15 Aug 2010 12:20:33 +0000 (13:20 +0100)]
lvm - adjust visibility for devname
* adjust visibility in lib/dragonfly/dev.c to show devname(), avoiding
truncation of higher 32 bits on x86_64, since otherwise the return
value defaults to int.
Reported-by: Sascha Wildner (swildner@)
Alex Hornung [Sun, 15 Aug 2010 10:09:26 +0000 (11:09 +0100)]
linuxulator - Acquire MPLOCK for ksignal
* Don't forget to acquire mplock for ksignal, or otherwise we'll get a
panic (MP_LOCK_HELD: Not held thread foo).
Matthew Dillon [Sun, 15 Aug 2010 00:51:42 +0000 (17:51 -0700)]
kernel - dm - Reorganize the crypt code and implement B_HASBOGUS
* Implement B_HASBOGUS data copying for read decryption. When a buffer
contains bogus pages we may or may not be able to safely decrypt data
in-place, add some code to deal with it.
* Reorganize the crypt code. Separate the read and write paths and
organize the procedures in the same order as the execution stages.
Also move some of the buffer manipulation around a little to make
it more clear.
Submitted-by: alexh (B_HASBOGUS handling)
Matthew Dillon [Sat, 14 Aug 2010 23:19:17 +0000 (16:19 -0700)]
kernel - dm - Fix panic in dm_target_crypt
* Fix a misordered kfree()
* Minor cleanup
Reported-by: alexh
Alex Hornung [Sat, 14 Aug 2010 22:01:47 +0000 (23:01 +0100)]
cryptsetup - fix buffer overflow
* fix a buffer overflow introduced during the porting. Linux originally
did digest = gcry_md_read(hd, hash_id); memcpy(dst, digest, len);
I ported that to do EVP_DigestFinal directly into dst, causing
corruption. Avoid this by writing to some intermediate (large) buffer
and then using memcpy like Linux does.
Alex Hornung [Sat, 14 Aug 2010 20:17:27 +0000 (21:17 +0100)]
cryptsetup - fix issue with uuid
* the whole codepath related to uuid was a bit messy. Nothing should've
been done if uuid==NULL and the result was passed in as integer, not
pointer...
Matthew Dillon [Sat, 14 Aug 2010 19:10:39 +0000 (12:10 -0700)]
kernel - netif - temporary hack for IFT_ETHER
* Temporarily hack if_alloc() to allocate a struct arpcom instead of a
struct ifnet when IFT_ETHER is passed in, until we can adjust all the
drivers to use the ifnet->if_l2com API.
Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
Matthew Dillon [Sat, 14 Aug 2010 19:04:52 +0000 (12:04 -0700)]
kernel - dm - Add support for BUF_CMD_FLUSH
* Change the nestiobuf_*() code to count the number of sub-bios issued
instead of counting the resid. This allows the nestiobuf_*() API to
be used to BUF_CMD_FLUSH.
* Change the nestiobuf_*() API. The nestiobuf_start() command is now
nestiobuf_add(). Add a nestiobuf_init(mbio) and nestiobuf_start(mbio)
wrapper around the adds.
* Explicitly check for allowed BUF_CMD_* commands in device-mapper.c
* Add a bypass to device-mapper.c to cause certain commands to be sent
to all tbl's (BUF_CMD_FLUSH).
* Add explicit suppor for BUF_CMD_FLUSH to dm_target_stripe.c
* Change b_resid loading semantics to load upon completion of the
I/O.
Matthew Dillon [Sat, 14 Aug 2010 17:53:43 +0000 (10:53 -0700)]
kernel - flag when bogus_page's are present
* Flag a buffer when bogus pages are present. Add B_HASBOGUS to b_flags.
Certain in-place read operations, such as decryption, must allocate a
copy if the original buffer contains bogus pages.
Matthew Dillon [Sat, 14 Aug 2010 17:06:21 +0000 (10:06 -0700)]
kernel - dm - rewrite dm_target_stripe.c to add functionality and fix bugs
* The stripe code now allows up to 32 devices, instead of just 2
* The stripe code now properly cleans up partial configurations which
fail in the device loop.
* Fix improper use of M_NOWAIT
* Fix improper use of malloc pool in *_status functions
* Fix improper use of namespace (atoi -> atoi64)
* Cleanup some M_DM malloc declarations
Matthew Dillon [Sat, 14 Aug 2010 15:45:50 +0000 (08:45 -0700)]
kernel - devfs - Fix dangling lock created by recent commit
* devfs_freep() is not always called with devfs_lock held
Reported-by: alexh
Alex Hornung [Sat, 14 Aug 2010 08:37:54 +0000 (09:37 +0100)]
libdm/lvm - Fix bugs
* Allow adding symlinks to lvm's dev-cache by translating the symlink
for udev/libdevattr.
* Don't include kdev_t.h in libdm since it has the wrong macros for
MAJOR and MINOR; instead include netbsd's version.
Reported-by: Matt Dillon (dillon@)
Matthew Dillon [Sat, 14 Aug 2010 01:01:13 +0000 (18:01 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly