Commit Graph

6532 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
3dea75d2a8 Move all NV defines into nv.c, they are not used externally thus there is
no need to make then visible from outside.

MFC after:	3 days
2010-10-24 17:22:34 +00:00
Pawel Jakub Dawidek
1f39b27946 Simplify code a bit.
MFC after:	3 days
2010-10-24 15:44:23 +00:00
Pawel Jakub Dawidek
d7be7905ae Plug memory leak.
MFC after:	3 days
2010-10-24 15:42:16 +00:00
Pawel Jakub Dawidek
584a9bc3f8 Plug memory leaks.
Found with:	valgrind
MFC after:	3 days
2010-10-24 15:41:23 +00:00
Pawel Jakub Dawidek
2964aeb34a Load geom_gate.ko module after parsing arguments.
MFC after:	3 days
2010-10-24 15:38:58 +00:00
Ulrich Spörlein
2914feeb7e mdoc: make pages render with mandoc
It's a bit more pedantic regarding .Bl list elements. This has an added
benefit of unbreaking the ipfw(8) manpage, where groff was silently
skipping one list element.
2010-10-21 12:27:13 +00:00
Pawel Jakub Dawidek
6c71649c5f Use closefrom(2) instead of close(2) in a loop.
MFC after:	1 week
2010-10-20 21:10:01 +00:00
Pawel Jakub Dawidek
5ad4a7c74a Bring in geli suspend/resume functionality (finally).
Before this change if you wanted to suspend your laptop and be sure that your
encryption keys are safe, you had to stop all processes that use file system
stored on encrypted device, unmount the file system and detach geli provider.

This isn't very handy. If you are a lucky user of a laptop where suspend/resume
actually works with FreeBSD (I'm not!) you most likely want to suspend your
laptop, because you don't want to start everything over again when you turn
your laptop back on.

And this is where geli suspend/resume steps in. When you execute:

	# geli suspend -a

geli will wait for all in-flight I/O requests, suspend new I/O requests, remove
all geli sensitive data from the kernel memory (like encryption keys) and will
wait for either 'geli resume' or 'geli detach'.

Now with no keys in memory you can suspend your laptop without stopping any
processes or unmounting any file systems.

When you resume your laptop you have to resume geli devices using 'geli resume'
command. You need to provide your passphrase, etc. again so the keys can be
restored and suspended I/O requests released.

Of course you need to remember that 'geli suspend' won't clear file system
cache and other places where data from your geli-encrypted file system might be
present. But to get rid of those stopping processes and unmounting file system
won't help either - you have to turn your laptop off. Be warned.

Also note, that suspending geli device which contains file system with geli
utility (or anything used by 'geli resume') is not very good idea, as you won't
be able to resume it - when you execute geli(8), the kernel will try to read it
and this read I/O request will be suspended.
2010-10-20 20:50:55 +00:00
Rebecca Cran
f0129ea88b Stop disallowing device nodes to be passed to camcontrol(8) since libcam
already allows both device names and nodes to be specified.

Reviewed by:	avg
2010-10-19 20:05:25 +00:00
Ulrich Spörlein
7cc1fde083 mdoc: drop even more redundant .Pp calls
No change in rendered output, less mandoc lint warnings.

Tool provided by:	Nobuyuki Koganemaru n-kogane at syd.odn.ne.jp
2010-10-19 12:35:40 +00:00
Pawel Jakub Dawidek
3f562cce40 Log correct connection when canceling half-open connection.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-10-17 15:47:27 +00:00
Pawel Jakub Dawidek
bb317aa6ea Use one fprintf() instead of two.
MFC after:	3 days
2010-10-16 22:50:12 +00:00
Pawel Jakub Dawidek
c0a124e6ce Clear signal mask before executing a hook.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-10-16 22:48:48 +00:00
Luigi Rizzo
81ab11744e document logging through bpf 2010-10-13 22:07:57 +00:00
Ed Schouten
5a25553cc3 Remove stale reference to wtmp(5).
Reported by:	pluknet
2010-10-11 20:17:23 +00:00
Jaakko Heinonen
7f79e870d2 - Print the nmount(2) provided error message only when it is set.
- Ensure that the error message is NUL-terminated before printing it.

PR:		bin/147482
MFC after:	2 weeks
2010-10-10 09:24:19 +00:00
Andrey V. Elsukov
21bf062e7e Replace strlen(_PATH_DEV) with sizeof(_PATH_DEV) - 1.
Suggested by:	kib
Approved by:	kib (mentor)
MFC after:	5 days
2010-10-09 20:20:27 +00:00
Warner Losh
9b6cb52091 Allow the kernel to generate more spacy things and still have devd
cope.  Skip multiple spaces in a few contexts.

PR:		96854
Submitted by:	Shin'ya Kumabuchi
MFC after:	1 week
2010-10-09 07:29:13 +00:00
Pawel Jakub Dawidek
51c63dce86 We can't zero out ggio request, as we have some fields in there we initialize
once during start-up.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-10-08 15:05:39 +00:00
Pawel Jakub Dawidek
022f07b682 We close the event socketpair early in the mainloop to prevent spaming with
error messages, so when we clean up after child process, we have to check if
the event socketpair is still there.

Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-10-08 15:02:15 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Pawel Jakub Dawidek
4e47b646bb Clear ggate structures before using them. We don't initialize all the field
and there can be some garbage from the stack.

MFC after:	1 week
2010-10-07 18:23:28 +00:00
Pawel Jakub Dawidek
783ee75392 Log error message when we fail to destroy ggate provider.
MFC after:	3 days
2010-10-07 18:20:16 +00:00
Pawel Jakub Dawidek
4a88128b01 Start the guard thread first, so we can handle signals from the very begining.
Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2010-10-07 18:19:02 +00:00
Pawel Jakub Dawidek
b46198a5db Don't close local component on exit as we can hang waiting on g_waitidle.
I'm unable to reproduce the race described in comment anymore and also the
comment is incorrect - localfd represents local component from configuration
file, eg. /dev/da0 and not HAST provider.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2010-10-07 18:16:22 +00:00
Pawel Jakub Dawidek
428ad0a9c4 Decrease report interval to 5 seconds, as this also means we will check for
signals every 5 seconds and not every 10 seconds as before.

MFC after:	3 days
2010-10-04 21:44:26 +00:00
Pawel Jakub Dawidek
5f24b330df hook_check() is now only used to report about long-running hooks, so the
argument is redundant, remove it.

MFC after:	3 days
2010-10-04 21:43:06 +00:00
Pawel Jakub Dawidek
41013c0b21 We can't mask ignored signal, so install dummy signal hander for SIGCHLD before
masking it.

This fixes bogus reports about hooks running for too long and other problems
related to garbage-collecting child processes.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-10-04 21:41:18 +00:00
Jaakko Heinonen
72da547037 Fix printing of the "rw" mount option in fstab(5) format (-p option).
fstab(5) format requires that one of "rw", "rq" or "ro" is always
specified.

PR:		bin/123021
Reviewed by:	keramida, rodrigc
MFC after:	2 weeks
2010-09-30 13:31:35 +00:00
Pawel Jakub Dawidek
15d98d9738 Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.

Reviewed by:	simon, rpaulo
MFC after:	2 weeks
2010-09-28 09:07:00 +00:00
Andrey V. Elsukov
6259ffb455 Remove superfluous word from "gpart bootcode" usage message.
Approved by:	kib (mentor)
2010-09-26 21:48:32 +00:00
Pawel Jakub Dawidek
b71de2e057 Plug memory leak on fork(2) failure.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-09-26 10:39:01 +00:00
Pawel Jakub Dawidek
1cf3d5ee99 - Add support for loading passphrase from a file (-J and -j options).
This is especially useful for things like installers, where regular
  geli prompt can't be used.
- Add support for specifing multiple -K or -k options, so there is no
  need to cat all keyfiles and read them from standard input.

Requested by:	Kris Moore <kris@pcbsd.org>, thompsa
MFC after:	2 weeks
2010-09-25 17:38:57 +00:00
Kirk McKusick
8d408dff91 Reported problem:
Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192"
show incorrect results from "df" for free and used space when mounted
immediately after creation. fsck on the new filesystem (before ever
mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5.

This error hasn't occurred in any runs of fsck immediately after
"newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option).

Solution:
The default UFS1 superblock is located at offset 8K in the filesystem
partition; the default UFS2 superblock is located at offset 64K in
the filesystem partition. For UFS1 filesystems with a blocksize of
64K, the first alternate superblock resides at 64K which is the the
location used for the default UFS2 superblock. By default, the
system first checks for a valid superblock at the default location
for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
64K, there is a valid UFS1 superblock at this location.  Thus, even
though it is expected to be a backup superblock, the system will
use it as its default superblock. So, we have to ensure that all the
statistcs on usage are correct in this first alternate superblock
as it is the superblock that will actually be used.

While tracking down this problem, another limitation of UFS1 became
evident. For UFS1, the number of inodes per cylinder group is stored
in an int16_t. Thus the maximum number of inodes per cylinder group
is limited to 2^15 - 1. This limit can easily be exceeded for block
sizes of 32K and above. Thus when building UFS1 filesystems, newfs
must limit the number of inodes per cylinder group to 2^15 - 1.

Reported by: Guy Helmer<ghelmer@palisadesys.com>
Followup by: Bruce Cran <brucec@freebsd.org>
PR:          107692
MFC after:   4 weeks
2010-09-24 19:08:56 +00:00
Andrey V. Elsukov
6305a96c20 Implement "force" (-F) option for gpart destroy verb.
This option doesn't passed to kernel and handled in user-space.
With -F option gpart creates new "delete" request for each
partition in table. Each request has flags="X" that disables
auto-commit feature. Last request is the original "destroy" request.
It has own flags and can have disabled or enabled auto-commit feature.
If error is occurred when deleting partitions, then new "undo" request
is created and all changes will be rolled back.

Approved by:	kib (mentor)
2010-09-24 08:40:43 +00:00
Pawel Jakub Dawidek
7157a8ad7d - Simplify code by using g_*() API.
- Don't use u_char and u_int in userland.
- Change 'unsigned' to 'unsigned int'.
- Update copyright years.

MFC after:	1 week
2010-09-23 12:04:12 +00:00
Pawel Jakub Dawidek
cdf8ab6198 Update copyright years.
MFC after:	1 week
2010-09-23 12:02:42 +00:00
Pawel Jakub Dawidek
07f1d01429 Document AES-XTS.
MFC after:	1 week
2010-09-23 12:00:40 +00:00
Pawel Jakub Dawidek
d2ac2ff105 - When trashing metadata, repeat overwrite kern.geom.eli.overwrites times.
- Flush write cache after each write.

MFC after:	1 week
2010-09-23 11:18:02 +00:00
Pawel Jakub Dawidek
488186c304 - Use g_*() API when doing backups.
- fsync() created filed.

MFC after:	1 week
2010-09-23 11:04:50 +00:00
Pawel Jakub Dawidek
2ecb2a01e7 Because we first write metadata into new place and then trash old place we
don't want situation where old size is equal to new size, as we will trash
newly written metadata.

MFC after:	1 week
2010-09-23 10:58:13 +00:00
Pawel Jakub Dawidek
429cf66400 - Make use of g_*() API.
- Flush cache after writing metadata.

MFC after:	1 week
2010-09-23 10:55:45 +00:00
Pawel Jakub Dawidek
5cd61a1fb7 Simplify code a bit by using g_*() API from libgeom.
MFC after:	1 week
2010-09-23 10:50:17 +00:00
Pawel Jakub Dawidek
9dd5a6cb0f Switch to sigprocmask(2) API also in the main process and secondary process.
This way the primary process inherits signal mask from the main process,
which fixes a race where signal is delivered to the primary process before
configuring signal mask.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-09-22 19:08:11 +00:00
Pawel Jakub Dawidek
196abd3518 Assert that descriptor numbers are sane.
MFC after:	3 days
2010-09-22 19:05:54 +00:00
Pawel Jakub Dawidek
8b70e6ae9c Fix possible deadlock where worker process sends an event to the main process
while the main process sends control message to the worker process, but worker
process hasn't started control thread yet, because it waits for reply from the
main process.

The fix is to start the control thread before sending any events.

Reported and fix suggested by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-09-22 19:03:11 +00:00
Pawel Jakub Dawidek
0c24d8e2a1 Fix descriptor leaks: when child exits, we have to close control and event
socket pairs. We did that only in one case out of three.

MFC after:	3 days
2010-09-22 18:57:06 +00:00
Pawel Jakub Dawidek
c56cf19ebf If we are unable to receive control message is most likely because the main
process died. Instead of entering infinite loop, terminate.

MFC after:	3 days
2010-09-22 18:39:43 +00:00
Pawel Jakub Dawidek
351b9a37a4 Sort includes.
MFC after:	3 days
2010-09-22 18:38:02 +00:00
Ed Schouten
8aecb90468 Add a notice to the man page that batteries should be installed. 2010-09-21 08:25:00 +00:00
Brian Somers
044bf69fd5 Add a geli resize subcommand to resize encrypted filesystems prior
to growing the filesystem.

Refuse to attach providers where the metadata provider size is
wrong.  This makes post-boot attaches behave consistently with
pre-boot attaches.  Also refuse to restore metadata to a provider
of the wrong size without the new -f switch.  The new -f switch
forces the metadata restoration despite the provider size, and
updates the provider size in the restored metadata to the correct
value.

Helped by:	pjd
Reviewed by:	pjd
2010-09-20 22:04:59 +00:00
Pawel Jakub Dawidek
e43e02f1a4 Add __dead2 to functions that we know they are going to exit.
MFC after:	3 days
2010-09-20 13:23:43 +00:00
Marcel Moolenaar
e29560acd7 Unbreak the build on strong-aligned architectures (arm, ia64).
Casting from (char *) to (struct ufs1_dinode *) changes the
alignment requirement of the pointer and GCC does not know that
the pointer is adequately aligned (due to malloc(3)), and warns
about it. Cast to (void *) first to by-pass the check.
2010-09-20 04:20:55 +00:00
Pawel Jakub Dawidek
e38060039e Fix indent. 2010-09-19 10:51:55 +00:00
Brian Somers
1ad5f80fac Revise r197763 which fixes filesystem corruption when extending
into un-zeroed storage.

The original patch was questioned by Kirk as it forces the filesystem
to do excessive work initialising inodes on first use, and was never
MFC'd.  This change mimics the newfs(8) approach of zeroing two
blocks of inodes for each new cylinder group.

Reviewed by:	mckusick
MFC after:	3 weeks
2010-09-19 08:18:56 +00:00
Andriy Gapon
aa997bb947 nextboot: warn about limitations of /boot/nextboot.conf on ZFS
MFC after:	1 week
2010-09-17 09:50:36 +00:00
Marko Zec
13e86ef7ee Make the format of "Real Memory" and "Virtual Memory" lines more
consistent with the rest of sysctl vm.vmtotal output.

MFC after:	3 days
2010-09-16 10:53:01 +00:00
Brian Somers
6a5ffa0630 Add support for identifying a journaled root filesystem.
Fix support for identifying the given /dev/vinum/root example.

MFC after:	3 weeks
2010-09-16 08:16:53 +00:00
Pawel Jakub Dawidek
b5b293e37a GPART_PARAM_INDEX is now G_TYPE_NUMBER. 2010-09-15 21:37:26 +00:00
Pawel Jakub Dawidek
628ec6d344 Remove dead code. 2010-09-14 20:54:22 +00:00
Pawel Jakub Dawidek
fa5383a260 Remove now unused G_TYPE_ASCNUM. 2010-09-14 16:22:22 +00:00
Pawel Jakub Dawidek
8107ecf892 - Change all places where G_TYPE_ASCNUM is used to G_TYPE_NUMBER.
It turns out the new type wasn't really needed.
- Reorganize code a little bit.
2010-09-14 16:21:13 +00:00
Pawel Jakub Dawidek
56382b5f76 Update two last places where "arg0" should be used instead of "geom". 2010-09-14 16:19:09 +00:00
Glen Barber
75f01cd104 Synchronize newfs(8) manual with code.
PR:		61716
Submitted by:	Radim Kolar <hsn at netmag cz>
Patch by:	arundel
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-14 12:12:07 +00:00
Pawel Jakub Dawidek
d1db39d90e All gpart(8) subcommands apart from the 'bootcode' subcommand handle
given geom/provider names with and without /dev/ prefix. Teach the
'bootcode' subcommand to handle /dev/<foo> names as well.
2010-09-14 11:36:26 +00:00
Pawel Jakub Dawidek
f104beb787 Remove dot which shouldn't be here, as err(3) will attach error message
at the end of the string.
2010-09-14 11:19:21 +00:00
Pawel Jakub Dawidek
7648b1e9c0 Introduce special G_VAL_OPTIONAL define, which when given in value field
tells geom(8) to ignore it when it is not given and don't try to obtain
default value.
2010-09-14 11:13:46 +00:00
Pawel Jakub Dawidek
315fcbf7db Add G_TYPE_MULTI flag, which when set for the given option, will
allow the option to be specified multiple times. This will help to
implement things like passing multiple keyfiles to geli(8) instead of
cat(1)ing them all into stdin and reading from there using one '-k -'
option.
2010-09-13 13:59:28 +00:00
Pawel Jakub Dawidek
946e2f3595 - Remove gc_argname field. It was introduced for gpart(8), but if I
understand everything correctly, we don't really need it.
- Provide default numeric value as strings. This allows to simplify
  a lot of code.
- Bump version number.
2010-09-13 13:48:18 +00:00
Pawel Jakub Dawidek
a478ea7490 - Allow to specify value as const pointers.
- Make optional string values always an empty string.
2010-09-13 08:56:07 +00:00
Warner Losh
130ecf684f MF tbemd: Move to using Makefile.arch to select what to build.
Reviewed by:	arch@ (no objection)
2010-09-13 02:25:21 +00:00
Glen Barber
92d01db21c Rewording and typo fixes in newfs(8).
PR:		150490
Submitted by:	Eitan Adler <foreignuser at eitanadler com>
Additional fixes by:	Warren Block <wblock at wonkity com>, keramida
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-12 17:50:07 +00:00
Brian Somers
5172455266 Document dhclient-enter-hooks and dhclient-exit-hooks and mention
how to configure dhclient to clear the interface of IP numbers prior
to configuring it.

PR:		149351
MFC after:	2 weeks
2010-09-06 09:59:10 +00:00
Brian Somers
1dc7e010ec Handle geli-encrypted root disk devices.
MFC after:	2 weeks
2010-09-06 04:15:49 +00:00
Daichi GOTO
21f9b7b28a Allowed unionfs to use whiteout not supporting file system as
upper layer. Until now, unionfs prevents to use that kind of
file system as upper layer. This time, I changed to allow
that kind of file system as upper layer. By this change, you
can use whiteout not supporting file system (e.g., especially
for tmpfs) as upper layer. It's very useful for combination of
tmpfs as upper layer and read only file system as lower layer.

By difinition, without whiteout support from the file system
backing the upper layer, there is no way that delete and rename
operations on lower layer objects can be done.  EOPNOTSUPP is
returned for this kind of operations as generated by VOP_WHITEOUT()
along with any others which would make modifica tions to the
lower layer, such as chmod(1).

This change is suggested by ed.

Submitted by:	ed
2010-09-05 04:58:16 +00:00
Kevin Lo
d0654c8566 Shut the compiler up; initializes the sotype variable to zero in
nfs_tryproto().

Reviewed by:	rmacklem
2010-09-04 08:42:19 +00:00
Maxim Konovalov
2888756701 o List MOUNTVER and SCHED classes. X-ref gsched(8). Bump Dd.
PR:		docs/149925
Submitted by:	arundel
2010-09-01 08:32:40 +00:00
Pawel Jakub Dawidek
6d19256b15 Include process PID in log messages.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	2 weeks
2010-08-31 12:05:13 +00:00
Pawel Jakub Dawidek
8ecdeae9d9 Correct error message.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	2 weeks
2010-08-31 12:03:29 +00:00
Pawel Jakub Dawidek
71c895eb1f Forgot to add event.c and event.h in r212038.
Pointed out by:	pluknet <pluknet@gmail.com>
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-31 09:38:43 +00:00
Pawel Jakub Dawidek
852ac373cb Mask only those signals that we want to handle.
Suggested by:	jilles
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-31 06:22:03 +00:00
Pawel Jakub Dawidek
5bdff860e7 Because it is very hard to make fork(2) from threaded process safe (we are
limited to async-signal safe functions in the child process), move all hooks
execution to the main (non-threaded) process.

Do it by maintaining connection (socketpair) between child and parent
and sending events from the child to parent, so it can execute the hook.

This is step in right direction for others reasons too. For example there is
one less problem to drop privs in worker processes.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 23:26:10 +00:00
Pawel Jakub Dawidek
6b276294af We only want to know if descriptors are ready for reading.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 23:19:21 +00:00
Pawel Jakub Dawidek
eea2deaad0 When someone gives NULL as data, assume this is because he want to declare
connection side only.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 23:16:45 +00:00
Pawel Jakub Dawidek
6be3a25c85 Use pjdlog_exit() before fork().
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 22:28:04 +00:00
Pawel Jakub Dawidek
b938cdcc9b Constify arguments we can constify.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 22:26:42 +00:00
Maxim Konovalov
1ece82b487 Make flags in usage() and SYNOPSYS more style(9)-ish.
Suggested by:	brian
MFC after:	3 days
2010-08-30 07:29:27 +00:00
Pawel Jakub Dawidek
5b41e64486 Execute hook when connection between the nodes is established or lost.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 00:31:30 +00:00
Pawel Jakub Dawidek
2be8fd75ff Execute hook when split-brain is detected.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 00:12:10 +00:00
Pawel Jakub Dawidek
6d0c801ea9 Use sigtimedwait(2) for signals handling in primary process.
This fixes various races and eliminates use of pthread* API in signal handler.

Pointed out by:	kib
With help from:	jilles
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-30 00:06:05 +00:00
Pawel Jakub Dawidek
ff6bb1f8b3 - Move functionality responsible for checking one connection to separate
function to make code more readable.
- Be sure not to reconnect too often in case of signal delivery, etc.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 22:55:21 +00:00
Pawel Jakub Dawidek
ee087cdf97 Disconnect after logging errors.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 22:17:53 +00:00
Pawel Jakub Dawidek
a870e771b9 - Call hook on role change.
- Document new event.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 21:42:45 +00:00
Pawel Jakub Dawidek
ecc99c890e Allow to run hooks from the main hastd process.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 21:41:53 +00:00
Pawel Jakub Dawidek
25ec2e3e2b - Add hook_fini() which should be called after fork() from the main hastd
process, once it start to use hooks.
- Add hook_check_one() in case the caller expects different child processes
  and once it can recognize it, it will pass pid and status to hook_check_one().

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 21:39:49 +00:00
Pawel Jakub Dawidek
572cdb2216 Implement mtx_destroy() and rw_destroy().
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-29 21:37:21 +00:00
Ulrich Spörlein
b2d89ed701 gsched(8): fix example usage, mdoc nits
- ad0 was referred to as da0
- wrong parameter -s instead of -a in example
- use double quotes consistently

PR:            docs/150082
Submitted by:  N.J. Mann <njm@njm.me.uk>
MFC after:     2 weeks
2010-08-29 11:32:41 +00:00
Rebecca Cran
e7f8dd75b3 Fix incorrect usage of 'assure' and 'insure'.
Approved by: rrs (mentor)
2010-08-28 16:32:01 +00:00
Pawel Jakub Dawidek
5da2320932 When SIGTERM or SIGINT is received, terminate worker processes.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 21:28:02 +00:00
Pawel Jakub Dawidek
4767ee29f1 When logging to stdout/stderr, flush after each log.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 21:26:55 +00:00
Pawel Jakub Dawidek
b9cf0cf5fa Correct when we log interrupted synchronization.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 21:20:32 +00:00
Pawel Jakub Dawidek
eba09893fd Check if no signals were delivered just before going to sleep.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 20:49:06 +00:00
Pawel Jakub Dawidek
01125a9381 Add hooks execution.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 20:48:12 +00:00
Pawel Jakub Dawidek
ac59403c39 Document new 'exec' parameter.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 15:20:31 +00:00
Pawel Jakub Dawidek
0becad39a7 Allow to execute specified program on various HAST events.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 15:16:52 +00:00
Pawel Jakub Dawidek
1cdaf10c45 - Run hooks in background - don't block waiting for them to finish.
- Keep all hooks we're running in a global list, so we can report when
  they finish and also report when they are running for too long.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:38:12 +00:00
Pawel Jakub Dawidek
e64887c4d6 When logging to stdout/stderr don't close those descriptors after fork().
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:35:39 +00:00
Pawel Jakub Dawidek
3f828c18e5 Reduce indent where possible.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:28:39 +00:00
Pawel Jakub Dawidek
f7fe83f9f8 Implement keepalive mechanism inside HAST protocol so we can detect secondary
node failures quickly for HAST resources that are rarely modified.

Remove XXX from a comment now that the guard thread never sleeps infinitely.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:26:37 +00:00
Pawel Jakub Dawidek
8f8c798c13 - Remove redundant and incorrect 'old' word from debug message.
- Log disconnects as warnings.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:12:53 +00:00
Pawel Jakub Dawidek
e23d2d0187 Don't increase number synchronized bytes in case of an error.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:10:25 +00:00
Pawel Jakub Dawidek
53d9b386eb Log that synchronization was interrupted in a proper place.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:08:10 +00:00
Pawel Jakub Dawidek
55ce1e7c8b We have sync_start() function to start synchronization, introduce sync_stop()
function to stop it.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:06:00 +00:00
Pawel Jakub Dawidek
16bd7026a2 Add QUEUE_INSERT() and QUEUE_TAKE() macros that simplify the code a bit.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 14:01:28 +00:00
Pawel Jakub Dawidek
6e5f008ac4 Add mtx_owned() implementation.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 13:58:38 +00:00
Pawel Jakub Dawidek
7087d13fae Make comment more readable.
MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-08-27 13:54:17 +00:00
Jaakko Heinonen
e45d37b2e9 Don't attempt to write label with GEOM_BSD based method if the class is
not available. This improves error reporting when bsdlabel(8) is unable
to open a device for writing. If GEOM_BSD was unavailable, only a rather
obscure error message "Class not found" was printed.

PR:		bin/58390
Reviewed by:	ae
Discussed with:	marcel
MFC after:	1 month
2010-08-27 11:08:11 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Dag-Erling Smørgrav
35efcc8b69 expand_number(3) takes a uint64_t * now; intmax_t was never correct
except by accident.

MFC after:	3 weeks
2010-08-19 11:20:24 +00:00
Dag-Erling Smørgrav
1727cdb62a expand_number(3) takes a uint64_t * now.
MFC after:	3 weeks
2010-08-19 11:19:21 +00:00
Pawel Jakub Dawidek
28df1f238a For some setups sending data in 128kB chunks makes communication very slow. No
idea why. 32kB on the other hand seems to work properly everywhere.

Reported by:	Thomas Steen Rasmussen <thomas@gibfest.dk>
MFC after:	3 weeks
2010-08-18 12:09:27 +00:00
Pawel Jakub Dawidek
471bb09914 The 'size' variable is there to limit how many bytes we want to copy from
'addr'. It is very likely that size of 'addr' is larger than 'size', so checking
strlcpy() return value is bogus.

MFC after:	3 weeks
2010-08-16 21:59:56 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Jaakko Heinonen
fb26ece72c - Check that strtoul(3) succeeds to convert the entire string in a few
places.
- In getasciilabel(), set the disk type only when a valid type is given.

PR:		bin/86765
MFC after:	2 weeks
2010-08-15 17:49:41 +00:00
Matt Jacob
e02616caf0 Avoid a memory leak.
Submitted by:	Dmitry Luhtionov via Alexander Motin
MFC after:	1 week
2010-08-13 15:17:19 +00:00
Dag-Erling Smørgrav
c201d4532c - Add full support for header / data digests.
- Increase target limit from 4 to 64; this limit will be removed entirely
  at a later time.
- Improve recovery from lost network connections.
- Fix some potential deadlocks and a serious memory leak.
- Fix incorrect use of MH_ALIGN (instead of M_ALIGN), which makes no
  practical difference, but triggers a KASSERT with INVARIANTS.
- Fix some warnings in iscontrol(8) and improve the man page somewhat.

Submitted by:	Daniel Braniss <danny@cs.huji.ac.il>
Sponsored by:	Dansk Scanning A/S, Data Robotics Inc.
2010-08-09 12:36:36 +00:00
John Baldwin
d99d8e2e38 Ethernet vlan(4) interfaces have valid Ethernet link layer addresses but
use a different interface type (IFT_L2VLAN vs IFT_ETHER).  Treat IFT_L2VLAN
interfaces like IFT_ETHER interfaces when handling link layer addresses.

Reviewed by:	syrinx (bsnmpd)
MFC after:	1 week
2010-08-06 15:09:21 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Doug Barton
36d8ab97a0 Update the arguments to yy_config_parse() to match r210883.
Choose the more conservative option ('yes' to exit on error) to match
the equivalent code in hastd.
2010-08-06 05:20:21 +00:00
Pawel Jakub Dawidek
44d63cff2e Document 'none' value for remote.
Reviewed by:	dougb
MFC after:	1 month
2010-08-05 19:54:57 +00:00
Pawel Jakub Dawidek
0989854d45 Implement configuration reload on SIGHUP. This includes:
- Load added resources.
- Stop and forget removed resources.
- Update modified resources in least intrusive way, ie. don't touch
  /dev/hast/<name> unless path to local component or provider name were
  modified.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
MFC after:	1 month
2010-08-05 19:16:31 +00:00
Pawel Jakub Dawidek
bbbb114cda Prepare configuration parsing code to be called multiple times:
- Don't exit on errors if not requested.
- Don't keep configuration in global variable, but allocate memory for
  configuration.
- Call yyrestart() before yyparse() so that on error in configuration file
  we will start from the begining next time and not from the place we left of.

MFC after:	1 month
2010-08-05 19:08:54 +00:00
Pawel Jakub Dawidek
a00829bb71 Make control_set_role() more public. We will need it soon.
MFC after:	1 month
2010-08-05 19:04:29 +00:00
Pawel Jakub Dawidek
f377917cdc Allow to use 'none' keywork as remote address in case second cluster node
is not setup yet.

MFC after:	1 month
2010-08-05 19:01:57 +00:00
Pawel Jakub Dawidek
a2ef0636b4 Reset signal handlers after fork().
MFC after:	1 month
2010-08-05 18:58:00 +00:00
Pawel Jakub Dawidek
005f438bf5 - Use pjdlog_exitx() to log errors and exit instead of errx().
- Use 'unable to' (instead of 'cannot') consistently.

MFC after:	1 month
2010-08-05 18:56:24 +00:00
Pawel Jakub Dawidek
2c5dadc9cf Assert that various buffers we are large enough.
MFC after:	1 month
2010-08-05 18:27:41 +00:00
Pawel Jakub Dawidek
524840d8d0 Problem with assertion is that it logs on stderr. Add two macros:
PJDLOG_ASSERT() and PJDLOG_VERIFY() that will check the given condition
and log the problem where appropriate. The difference between those
two is that PJDLOG_VERIFY() always work and PJDLOG_ASSERT() can be
turned off by defining NDEBUG.

MFC after:	1 month
2010-08-05 18:26:38 +00:00
Pawel Jakub Dawidek
6b97e48326 Keep $FreeBSD$ in __FBSDID() only for C files.
MFC after:	1 month
2010-08-05 18:23:43 +00:00
Pawel Jakub Dawidek
e3031161eb Mark two more places that we won't reach.
MFC after:	1 month
2010-08-05 18:21:45 +00:00
Pawel Jakub Dawidek
9bf24e1a00 Now that TCP will be checked last we don't need any knowledge about other
protocols.

MFC after:	1 month
2010-08-05 17:57:59 +00:00
Pawel Jakub Dawidek
50692f84c6 Add an argument to the proto_register() function which allows protocol to
declare it is the default and be placed at the end of the queue so it is
checked last.

MFC after:	1 month
2010-08-05 17:56:41 +00:00
Bjoern A. Zeeb
08bb15b96f One question mark per question; everything else is just exaggerating.
reply() will output a '?', when printing the question along with [yn],
so no need to have another here.
2010-08-03 09:21:13 +00:00
Joel Dahl
a53bb70bda Spelling fixes. 2010-07-31 21:09:49 +00:00
Ulrich Spörlein
06d85cc61f gsched(8) was first released with FreeBSD 8.1
MFC after:	3 days
2010-07-30 12:56:34 +00:00
Pawel Jakub Dawidek
3d3063c0b3 Fix typo.
PR:		docs/149033
Submitted by:	Kolar <hsn@sendmail.cz>
MFC after:	3 days
2010-07-29 20:16:12 +00:00
Ulf Lilleengen
5bf0842244 - Avoid calling the copy constructor when it is not necessary. 2010-07-29 16:06:40 +00:00
Ulf Lilleengen
a75716fc2d - Remove unused instance of string. 2010-07-29 16:01:10 +00:00
Benedict Reuschling
629ce700d5 Small typo fix: s/ommited/omitted
PR:             docs/148977
Submitted by:   Warren Block (wblock at wonkity dot com)
MFC after:      4 days
2010-07-27 17:23:40 +00:00
Gleb Smirnoff
fa597729aa Document that the "ngtee" action no longer accepts packet, and
thus don't depend on one_pass flag anymore.

This is a POLA violation, but it is quite difficult to restore
the old behavior with new code. Also, the new behavior matches
behavior of the older "tee" action, and this is more intuitive.
2010-07-27 14:31:39 +00:00
Alexander Motin
8edcf69406 Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to
GEOM. This information needed for proper soft-RAID's on-disk metadata
reading and writing.
2010-07-25 15:43:52 +00:00
Benedict Reuschling
2c396c7a30 Clarify that the "number of bytes per sector"-range in the
-S option is meant to be "inclusive".

The original issue of the PR was already fixed.

PR:                 docs/142418
Submitted by:       David Naylor (naylor dot b dot david at gmail dot com)
No objection from:  kib
MFC after:          5 days
2010-07-25 11:31:29 +00:00
Kirk McKusick
5ee561ee3e Note that foreground fsck should be run after a filesystem related panic.
Suggested by:   Mikhail Teterin (mi@)
MFC after:      1 week
2010-07-23 14:35:51 +00:00
Andrey V. Elsukov
959059ef9e Document that SI unit suffixes are supported for -b and -s options
of add verb. Mention about maximum size limit for "freebsd-boot"
partition. It should be smaller than 545 KB (hardcoded in pmbr).
Show usage of SI unit suffixes in example.

Approved by:	mav (mentor)
MFC after:	1 week
2010-07-23 11:00:43 +00:00
Kirk McKusick
90104f5413 Note that foreground fsck should be run after a filesystem related panic.
Suggested by:	Mikhail Teterin (mi@)
MFC after:	1 week
2010-07-22 18:33:10 +00:00
Pawel Jakub Dawidek
1a517c3ec5 Actually, only the fullsync mode is implemented, not memsync mode.
Correct manual page.

MFC after:	3 days
2010-07-22 08:30:14 +00:00
Luigi Rizzo
f40be7f6f9 better printing of headers when listing flows 2010-07-15 14:34:56 +00:00
Alexander Motin
bb160d3d4b Do not bzero() NULL pointer on malloc() error.
Submitted by:	Dmitry Luhtionov
2010-07-14 15:14:00 +00:00
Maxim Konovalov
8173b7ae76 o Restore missed flag in the synopsis.
PR:		docs/148534
Submitted by:	Warren Block
MFC after:	1 week
2010-07-13 04:30:50 +00:00
Maxim Konovalov
b464045202 o Add -q flag to usage().
MFC after:	1 week
2010-07-13 04:13:31 +00:00
Maxim Konovalov
d7e1af0a5b o Add -q flag to the synopsis.
PR:		docs/148535
Submitted by:	Warren Block
MFC after:	1 week
2010-07-13 04:11:25 +00:00
Brian Somers
6964abef83 When dhclient obtains a lease, it runs dhclient-script and expects
it to configure the interface.  When the script is complete, dhclient
monitors the routing socket and will terminate if its address is
deleted or if its interface is removed or brought down.

Because the routing socket is already open when dhclient-script is
run, dhclient ignores address deletions for 10 seconds after the
script was run.

If the address that will be obtained is already configured on the
interface before dhclient starts, and if dhclient-script takes more
than 10 seconds (perhaps due to dhclient-*-hooks latencies), on script
completion, dhclient will immediately and silently exit when it sees
the RTM_DELADDR routing message resulting from the script reassigning
the address to the interface.

This change logs dhclient's reason for exiting and also changes the
10 second timeout to be effective from completion of dhclient-script
rather than from when it was started.

We now ignore RTM_DELADDR and RTM_NEWADDR messages when the message
contains no interface address (which should not happen) rather than
exiting.

Not reviewed by:	brooks (timeout)
MFC after:		3 weeks
2010-07-07 06:06:54 +00:00
Jeff Roberson
24d37c1eec - Permit zero length directories as a handled inconsistency. This allows
directory truncation to proceed before the link has been cleared.  This
   is accomplished by detecting a directory with no . or .. links and
   clearing the named directory entry in the parent.
 - Add a new function ino_remref() which handles the details of removing
   a reference to an inode as a result of a lost directory.  There were
   some minor errors in various subcases of this routine.
2010-07-06 07:07:29 +00:00
Matt Jacob
5d8d4137df Fix the clear function which has been broken for a bit.
MFC after:	1 week
2010-07-04 22:17:56 +00:00
Benedict Reuschling
d3f4dbc513 Let boot(8) refer to the uart(4) serial driver, which is the replacement
for the obsolete sio(4) driver.

PR:             docs/144498
Submitted by:   Bruce Cran (bruce at cran dot org dot uk)
Approved by:    marcel
MFC after:      2 weeks
2010-07-04 20:39:07 +00:00
Marcel Moolenaar
9a84deb804 sysctlbyname() returns -1 on error and sets errno. It does
not return the error itself.
2010-07-03 22:02:29 +00:00
Alexander Motin
72166fba33 Correct explanation for idle and standby subcommands' -t argument. 2010-07-01 14:10:55 +00:00
Jaakko Heinonen
049a97931c - Don't assign the return value from read(2) to a variable of type
int.
- Use errx(3) instead of err(3) to print the error message on short
  reads in readlabel(). errno won't be set on short reads which can
  easily occur here due to the fixed size read request.

PR:		144307
Reviewed by:	bde
2010-06-30 18:34:45 +00:00
Warner Losh
b8f92ce4de Expand system into my_system, and add the necessary tidyness that we
need.  Close the pidfile.  Then close all descriptors >= 3 to avoid
information leakage to children.

This solves the problem of not being able to restart devd when you
have, for example, a dhclient forked to configure your network...

MFC after:	3 days
2010-06-29 03:52:12 +00:00
Xin LI
edad602637 Improve fsck robustness for SU+J cases:
- Use err/errx only when the case is really fatal.  For other
   cases, fall back to full fsck instead of quiting fsck.
 - Plug a memory leak.
 - Avoid divide by zero when printing summary.
 - Output "FILE SYSTEM IS MARKED CLEAN" when a successful
   journal recovering is done.
 - When -f is specified, do full fsck instead of journal recovery.
2010-06-22 00:26:07 +00:00
Andrey V. Elsukov
02fc66090b Check for overflow before it occurs. Also add check for
negative numbers.

Suggested by:	ache
Approved by:	kib (mentor)
2010-06-21 12:50:54 +00:00
Andrey V. Elsukov
79d89bb0ab Remove G_TYPE_ASCLBA type and replace it with G_TYPE_STRING in gpart.
Move code that converts params from humanized numbers to sectors count
to subr.c and adjust comment.
Add post-processing for "size" and "start offset" params in gpart,
now they are properly converted to sectors count with known sector size
that can be greater that 512 bytes.
Also replace "unsigned long long" type to "off_t" for unify code since
it used for medium size in libgeom(3) and DIOCGMEDIASIZE ioctl.

PR:		bin/146277
Reviewed by:	marcel (previous version)
Approved by:	kib (mentor)
MFC after:	1 month
2010-06-21 08:24:50 +00:00
Ed Schouten
fafb8f11c0 Small style fixes:
- ANSIfy prototypes.
- Remove unneeded whitespace.
- Add const keyword to function where it can be used.
2010-06-20 12:52:33 +00:00
Brian Somers
48790afa7b Fix some style(9), although there's a lot more issues here.
Fix some casting errors.

PR:		142384
Submitted by:	giffunip at tutopia dot com
Obtained from:	NetBSD
MFC after:	3 weeks
2010-06-20 09:40:54 +00:00
Ulrich Spörlein
9eecb5528b mdoc nitpicking for gsched.8
- remove stray argument [1]
- remove stray whitespace
- use canonical wording for the HISTORY section

PR:		docs/147119 [1]
Submitted by:	Alexander Best <alexbestms@wwu.de> [1]
MFC after:	1 week
2010-06-19 18:52:37 +00:00
Rebecca Cran
99c1ee64f0 Call free and freeaddrinfo before exiting.
PR: bin/144730
PR: bin/144974
Submitted by: Earl R. Lapus <earl.lapus at gmail.com>
Approved by: rrs (mentor)
MFC after: 1 month
2010-06-16 15:49:17 +00:00
Pawel Jakub Dawidek
f3bd74124a Correct various log messages.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-06-14 21:46:48 +00:00
Pawel Jakub Dawidek
96610dd9b6 Fix typos.
MFC after:	3 days
2010-06-14 21:44:58 +00:00
Pawel Jakub Dawidek
328e0f4b04 Initialize gctl_seq for synchronization requests.
Reported by:	hiroshi@soupacific.com
Analysed by:	Mikolaj Golub <to.my.trociny@gmail.com>
Tested by:	hiroshi@soupacific.com, Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-06-14 21:44:20 +00:00
Pawel Jakub Dawidek
7a716e072e Plug memory leak.
Found by:	Coverity Prevent
CID:		7057
MFC after:	3 days
2010-06-14 21:41:22 +00:00
Pawel Jakub Dawidek
b0dfbe5b27 Plug memory leak.
Found by:	Coverity Prevent
CID:		7056
MFC after:	3 days
2010-06-14 21:37:25 +00:00
Pawel Jakub Dawidek
9f31eddba0 Plug memory leak.
Found by:	Coverity Prevent
CID:		7051
MFC after:	3 days
2010-06-14 21:33:18 +00:00
Pawel Jakub Dawidek
6744284aec Plug memory leaks.
Found by:	Coverity Prevent
CID:		7052, 7053, 7054, 7055
MFC after:	3 days
2010-06-14 21:25:20 +00:00
Pawel Jakub Dawidek
9fab3c1b94 Remove macros that are not really needed. The idea was to have them in case
we grow more descriptors, but I'll reconsider readding them once we get there.

Passing (a = b) expression to FD_ISSET() is bad idea, as FD_ISSET() evaluates
its argument twice.

Found by:	Coverity Prevent
CID:		5243
MFC after:	3 days
2010-06-14 21:18:58 +00:00
Pawel Jakub Dawidek
a58b195e35 Eliminate dead code.
Found by:	Coverity Prevent
CID:		5158
MFC after:	3 days
2010-06-14 21:01:13 +00:00
Ulrich Spörlein
3ba5db25bb Remove dead variable assignments
Found by:	clang static analyzer
Verified by:	md5(1)
2010-06-11 17:03:04 +00:00
Ulrich Spörlein
ee4912eb07 Initialize variables before usage.
Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 7736, 7760)
2010-06-11 17:02:57 +00:00
Andrey V. Elsukov
24609c49ca bgeom(3) does strdup of param name.
Don't leak memory when deleting param from gctl_req.

Reviewed by:	marcel
Approved by:	mav (mentor)
MFC after:	2 weeks
2010-06-07 07:41:41 +00:00
Marius Strobl
a7d366e958 - Mention that VTOC8 labels are found in Fujitsu SPARC64 machines as well.
- Add information regarding VTOC8 bootrstrap code and how it's handled with
  r208777 in place.
- Document the mapping of partition types to VTOC8 tags.
- Add examples for VTOC8 to the respective section.
- Eliminated hard sentence breaks.

Reviewed by:	marcel (slightly buggy version)
MFC after:	3 days
2010-06-03 13:04:56 +00:00
Marius Strobl
094fcb157d - In gpart_bootfile_read() fix an off-by-one error preventing the bootstrap
file to be of maximum size.
- Add special handling required for SMI/VTOC8 disklabel partcode, i.e. avoid
  overwriting the label when writing the bootstrap code to the partition
  starting at 0 and install it to all partitions when the -i option is omitted
  just like geom_sunlabel(4) and sunlabel(8) do by default.
- Add missing prototypes.
- Add const where applicable.

Reviewed by:	marcel
MFC after:	3 days
2010-06-03 13:01:55 +00:00
Jilles Tjoelker
7f482407a3 Clarify devfs manpages slightly.
mount(8): add xref to devfs(5)
devfs(5): change example to something more likely to be useful (it is not
necessary to mount a devfs on /dev manually, but for chroots/jails it is
often needed), mention since when devfs is preferred to device nodes on ufs

PR:		146600
MFC after:	2 weeks
2010-05-29 20:24:01 +00:00
Ulrich Spörlein
30fc54ea79 mdoc: .Ud has attitude, it takes no argument! 2010-05-27 13:56:40 +00:00
Kirk McKusick
97fea87b49 Add support to background fsck to delete zero-length directories. 2010-05-20 06:05:40 +00:00
Ulrich Spörlein
62486687ed mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
2010-05-19 08:57:53 +00:00
Jeff Roberson
5305359514 - Round up the journal size to the block size so we don't confuse fsck.
Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>

 - Only require 256k of blocks per-cg when trying to allocate contiguous
   journal blocks.  The storage may not actually be contiguous but is at
   least within one cg.
 - When disabling SUJ leave SU enabled and report this to the user.  It
   is expected that users will upgrade SU filesystems to SUJ and want
   a similar downgrade path.
2010-05-18 01:45:28 +00:00
Nathan Whitehorn
0532c3a5a5 Teach gpart about bootcode on APM. 2010-05-16 22:21:33 +00:00
Kevin Lo
73d6722d27 Use setresuid/setresgid to drop privileges 2010-05-16 08:03:24 +00:00
Bjoern A. Zeeb
68a6303904 Document the 'short preamble' capability for 802.11bg.
Reviewed by:	sam
MFC after:	4 days
2010-05-14 15:06:12 +00:00
Ulrich Spörlein
bbdc11d251 fsirand(8): make WARNS=3 clean
- Drop bogus quad_t cast for di_gen, it is a 32bit type
- Print di_gen with leading zeros, to get consistent output
  Before this change, amd64 would print:

  ino 18 gen 616ca2bd
  ino 19 gen ffffffff95c2a3ff
  ino 20 gen 25c3a3d5
  ino 21 gen 8dc1472
  ino 22 gen 3797056b
  ino 23 gen 1d47853a
  ino 24 gen ffffffff82d26995

  After the change

  ino 18 gen 616ca2bd
  ino 19 gen 95c2a3ff
  ino 20 gen 25c3a3d5
  ino 21 gen 08dc1472
  ino 22 gen 3797056b
  ino 23 gen 1d47853a
  ino 24 gen 82d26995

PR:		bin/139994 (sort of)
Reviewed by:	mckusick
2010-05-14 14:26:49 +00:00
Ulrich Spörlein
0b31f1f731 mdoc: move remaining sections into consistent order
This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:08:11 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Christian Brueffer
589fb6a1d9 Fix grammar in a line of output.
PR:		145343
Submitted by:	Hywel Mallett <hywel@hmallett.co.uk>
MFC after:	1 week
2010-05-12 20:21:44 +00:00
Christian Brueffer
8e721ea734 Casting size_t to uintmax_t is not necessary anymore. This also
removes the need for stdint.h inclusion.

PR:		146046
Submitted by:	Alexander Best <alexbestms@wwu.de>
Reviewed by:	kan
MFC after:	1 week
2010-05-12 15:47:43 +00:00
Kirk McKusick
945f418ab8 Final update to current version of head in preparation for reintegration. 2010-05-06 17:37:23 +00:00
Alexander Motin
da6808c111 Make SATA XPT negotiate and enable some additional SATA features, such as:
- device initiated power management (some devices support only this way);
 - Automatic Partial to Slumber Transition (more power saving);
 - DMA auto-activation (expected to slightly improve performance).
More features could be added later, when hardware supports.
2010-05-02 12:07:47 +00:00
Alexander Motin
f930c0db49 Add -d and -f arguments to camcontrol cmd, to execute DMA ATA commands. 2010-05-02 11:36:27 +00:00
Edwin Groothuis
727c128897 Improve usage of tunefs:
Document -j switch in usage() to reflect recent SUJ work.

Submitted by:   Alastair Hogge
MFC after:      1 week
2010-05-01 09:05:06 +00:00
Jeff Roberson
a6e09ef1c2 - Use the path to the filesystem mountpoint to look up the statfs
structure so that we correctly reload.  Note that tunefs doesn't
   properly detect the need to reload if the disk device is specified
   for a read-only mounted filesystem.
 - Lessen the contiguity requirement for the journal so that it is more
   likely to succeed.
2010-04-30 04:21:22 +00:00
Pawel Jakub Dawidek
d92714eea8 Default connection timeout is way too long. To make it shorter we have to
make socket non-blocking, connect() and if we get EINPROGRESS, we have to
wait using select(). Very complex, but I know no other way to define
connection timeout for a given socket.

Reported by:	hiroshi@soupacific.com
MFC after:	3 days
2010-04-29 21:55:20 +00:00
Pawel Jakub Dawidek
c6ddcbe009 - Check if the worker process was killed by signal and restart it.
- Improve logging.

Pointed out by:	Garrett Cooper <yanefbsd@gmail.com>
MFC after:	3 days
2010-04-29 15:42:24 +00:00
Pawel Jakub Dawidek
5571414ca8 Fix a problem where hastd will stuck in recv(2) after sending request to
secondary, which died between send(2) and recv(2). Do it by adding timeout
to recv(2) for primary incoming and outgoing sockets and secondary outgoing
socket.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
Tested by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-04-29 15:36:32 +00:00
Pawel Jakub Dawidek
83a5671405 Restart worker thread only if the problem was temporary.
In case of persistent problem we don't want to loop forever.

MFC after:	3 days
2010-04-28 22:41:06 +00:00
Pawel Jakub Dawidek
5abfc9c145 Mark temporary issues as such.
MFC after:	3 days
2010-04-28 22:39:47 +00:00
Pawel Jakub Dawidek
06c117d1d1 Use WEXITSTATUS() to obtain real exit code.
MFC after:	3 days
2010-04-28 22:26:30 +00:00
Pawel Jakub Dawidek
1228041bd5 Don't assume that "resource" property is in metadata.
Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-04-28 22:23:29 +00:00
Rui Paulo
2fb1e09dee Bump man page date. 2010-04-28 10:58:03 +00:00
Rui Paulo
f30f9d4006 Fix typos.
Obtained from:	DragonFlyBSD
2010-04-28 10:57:27 +00:00
Kirk McKusick
a4bf5fb987 Update to current version of head. 2010-04-28 05:33:59 +00:00
Jeff Roberson
df9109ee30 - Temporarily lower WARNS until I fix alignment warnings on sparc64.
Reported by:	Florian Smeets
2010-04-24 07:59:45 +00:00
Pawel Jakub Dawidek
132f1ed585 suj.c seems to contain two versions of the code.
Remove the one that doesn't compile.
2010-04-24 07:58:59 +00:00
Pawel Jakub Dawidek
d00690aec5 Protect fsck.h from being included twice. 2010-04-24 07:54:49 +00:00
Jeff Roberson
113db2dddb - Merge soft-updates journaling from projects/suj/head into head. This
brings in support for an optional intent log which eliminates the need
   for background fsck on unclean shutdown.

Sponsored by:   iXsystems, Yahoo!, and Juniper.
With help from: McKusick and Peter Holm
2010-04-24 07:05:35 +00:00
Marcel Moolenaar
665a080d71 Add and describe GEOM_PART_EBR. 2010-04-23 03:37:39 +00:00
Marcel Moolenaar
783310e6d9 Implement the resize command for resizing partitions. Without new
size, the partition in question is resized to fill all available
space. Quality work by Andrey!

Submitted by:	"Andrey V. Elsukov" <bu7cher@yandex.ru>
2010-04-23 03:14:04 +00:00
Andrew Thompson
139e9ad4d6 Document the new USB notification types. 2010-04-22 20:46:39 +00:00
Pawel Jakub Dawidek
36df4f8d05 Fix compilation with WITHOUT_CRYPT or WITHOUT_OPENSSL options.
Reported by:	Andrei V. Lavreniyuk <andy.lavr@reactor-xg.kiev.ua>
MFC after:	3 days
2010-04-22 19:18:10 +00:00
Maxim Konovalov
a8734ffdb3 o Add do-not-fragment option support to ping6(8).
PR:		bin/145759
Submitted by:	pluknet
MFC after:	1 month
2010-04-20 06:10:05 +00:00
Luigi Rizzo
d55ebfbd4e fix 64-bit build
Reported by:	Robert Noland
2010-04-19 16:35:47 +00:00
Luigi Rizzo
37133ba702 Slightly different handling of printf/snprintf for unaligned uint64_t,
which should improve readability, and also to ease the port to
platforms that do not support %llu

MFC after:	3 days
2010-04-19 15:11:45 +00:00
Pawel Jakub Dawidek
20ec52dc4b Fix log size calculation which caused message truncation.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-04-16 06:49:12 +00:00
Pawel Jakub Dawidek
09398e9bd4 Fix control socket leak when worker process exits.
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-04-16 06:47:29 +00:00
Pawel Jakub Dawidek
20b77db949 Increase ggate queue size to maximum value.
HAST was not able to stand heavy random load.

Reported by:	Hiroyuki Yamagami
MFC after:	3 days
2010-04-15 17:04:08 +00:00
Pawel Jakub Dawidek
54ddff9dfa Flush disk write cache after storing and clearing metadata. 2010-04-15 16:35:34 +00:00
Xin LI
57d848483e When an underlying ioctl(2) handler returns an error, our ioctl(2)
interface considers that it hits a fatal error, and will not copyout
the request structure back for _IOW and _IOWR ioctls, keeping them
untouched.

The previous implementation of the SIOCGIFDESCR ioctl intends to
feed the buffer length back to userland.  However, if we return
an error, the feedback would be defeated and ifconfig(8) would
trap into an infinite loop.

This commit changes SIOCGIFDESCR to set buffer field to NULL to
indicate the previous ENAMETOOLONG case.

Reported by:	bschmidt
MFC after:	2 weeks
2010-04-14 22:02:19 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Marcel Moolenaar
d7939b0cb5 The sequence number is now a node under which the MCA records are
hung by CPU id.
When showing the MCA record, print the MIB as a comment.

PR:		ia64/113102
2010-04-13 22:27:39 +00:00
Luigi Rizzo
83f8218814 fix copyright format, as requested by Joel Dahl 2010-04-13 09:56:17 +00:00
Luigi Rizzo
226cbe5ee3 use correct .PATH, remove unused CFLAGS 2010-04-13 09:52:42 +00:00
Luigi Rizzo
1831a90ac5 Bring in geom_sched, support for scheduling disk I/O requests
in a device independent manner. Also include an example anticipatory
scheduler, gsched_rr, which gives very nice performance improvements
in presence of competing random access patterns.

This is joint work with Fabio Checconi, developed last year
and presented at BSDCan 2009. You can find details in the
README file or at

http://info.iet.unipi.it/~luigi/geom_sched/
2010-04-12 16:37:45 +00:00
Luigi Rizzo
c083134268 fix a buffer overflow with large (100k+) number of input lines.
MFC after:	3 days
2010-04-12 08:27:53 +00:00
Hajimu UMEMOTO
c323a5fa93 Set net.inet6.ip6.fw.enable as well. 2010-04-06 12:28:08 +00:00
Matt Jacob
2b4969ff9e Change how multipath labels are created and managed. This makes it easier
to support various storage boxes which really aren't active-active.

We only write the label on the *first* provider. For all other providers
we just "add" the disk. This also allows for an "add" verb.

A usage implication is that you should specificy the currently active
storage path as the first provider.

Note that this does not add RDAC-like functionality, but better allows for
autovolumefailover configurations (additional checkins elsewhere will support
this).

Sponsored by:	Panasas
MFC after:	1 month
2010-03-29 18:04:06 +00:00
Pawel Jakub Dawidek
0d9014f354 Don't hold connection lock when doing reconnects as it makes I/Os wait for
connection timeouts.

Reported by:	Kevin Day <toasty@dragondata.com>
2010-03-27 16:35:07 +00:00
Maxim Konovalov
16d1ba4f62 o Fix typo.
PR:		docs/145031
Submitted by:	olgeni
MFC after:	1 week
2010-03-26 05:35:25 +00:00
Luigi Rizzo
c72c2330d0 fix another bug in "ipfw set N ..."
Submitted by:	Marcin Wisnicki
2010-03-24 23:06:16 +00:00
Rui Paulo
59f6c520f0 Add a missing LINE_BREAK() after printing the roaming parameters in
verbose mode.

Sponsored by:	iXsystems, inc.
MFC after:	2 weeks
2010-03-23 12:05:25 +00:00
Matt Jacob
b5dce617d8 Add 'rotate' and 'getactive' verbs to provide some control and information
about what the currently active path is.

Sponsored by:	Panasas
MFC after:	1 month
2010-03-21 15:02:47 +00:00
Gavin Atkinson
67d438ccb8 Tweak language to make one point potentially clearer for non-native spekers
PR:		bin/121424
Submitted by:	"Julian H. Stacey" <jhs berklix.org>
2010-03-20 14:42:16 +00:00
Qing Li
6b533b5ddb Verify interface up status using its link state only
if the interface has such capability. The interface
capability flag indicates whether such capability
exists. This approach is much more backward compatible.
Physical device driver changes will be part of another
commit.

Also updated the ifconfig utility to show the LINKSTATE
capability if present.

Reviewed by:	rwatson, imp, juli
MFC after:	3 days
2010-03-16 17:59:12 +00:00
Luigi Rizzo
b74331bfb8 accept lower case m as a synonym for Mega (bit/s or bytes/s). 2010-03-15 18:26:09 +00:00