Commit Graph

6547 Commits

Author SHA1 Message Date
Sergey Kandaurov
603c2b9b9b Remove vestiges of disklabel(5).
Reviewed by:	uqs
MFC after:	5 days
2011-04-14 08:53:04 +00:00
Pawel Jakub Dawidek
ac6518673e The replication mode that is currently support is fullsync, not memsync.
Correct this and print a warning if different replication mode is
configured.

MFC after:	1 week
2011-04-12 19:13:10 +00:00
Mikolaj Golub
a827fe1fdf In hast_proto_recv() remove unnecessary check. The size is checked
later in hast_proto_recv_data().

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-10 15:28:37 +00:00
Mikolaj Golub
1d521b1cbd In hast_proto_recv_data() check that the size of the data to be
received does not exceed the buffer size.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-10 15:21:46 +00:00
Mikolaj Golub
47f1eb5c4b Fix a typo in comments.
Approved by:	pjd (mentor)
MFC after:	3 days
2011-04-10 15:11:19 +00:00
Mikolaj Golub
d4aac54c51 hastd(8) maintains a map of dirty extents, not hastctl(8). Fix this.
Approved by:	pjd (mentor)
MFC after:	3 days
2011-04-10 15:07:54 +00:00
Glen Barber
66e0e139ee Correct 'list scan' description in the examples. The previous description
was incorrect - 'list scan' does not actually do a scan, but instead lists
the results of the background 'scan' cache.

Submitted by:	Fabian Keil (freebsd-listen of fabiankeil de) (via email)
Discussed with:	bschmidt
MFC after:	3 days
2011-04-06 11:20:54 +00:00
David E. O'Brien
1e3f14466b * Add the readline(3) API to libedit. The libedit versions of
{readline,history}.h are in /usr/include/edit so as to not conflict with
  the GNU libreadline versions.  To use the libedit readline(3) one should
  add "-I/usr/include/edit" to their Makefile
  (spelled "-I${DESTDIR}/${INCLUDEDIR}/edit" within the FreeBSD source tree).

* Enable its use in the BSD licensed utilities that support readline(3).

* To make it easier to sync libedit development with NetBSD, histedit.h
  is moved into libedit's directory as history shows shown we keep merging
  it into that location.

Obtained from:	NetBSD
Sponsored by:	Juniper Networks
2011-04-05 18:41:01 +00:00
Pawel Jakub Dawidek
39526f7fb6 Increase default timeout from 5 seconds to 20 seconds. 5 seconds is definitely
to short under heavy load and I was experiencing those timeouts in my recent
tests.

MFC after:	1 week
2011-04-02 09:34:33 +00:00
Pawel Jakub Dawidek
41bb85146b Handle ENOBUFS on send(2) by retrying for a while and logging the problem.
MFC after:	1 week
2011-04-02 09:31:02 +00:00
Pawel Jakub Dawidek
a7ebb3eb8b When we are operating on blocking socket and get EAGAIN on send(2) or recv(2)
this means that request timed out. Translate the meaningless EAGAIN to
ETIMEDOUT to give administrator a hint that he might need to increase timeout
in configuration file.

MFC after:	1 month
2011-04-02 09:29:53 +00:00
Pawel Jakub Dawidek
02dfe9724c Declare directions for sockets between primary and secondary.
In HAST we use two sockets - one for only sending the data and one for only
receiving the data.

MFC after:	1 month
2011-04-02 09:25:13 +00:00
Pawel Jakub Dawidek
3a0b818f59 Allow to disable sends or receives on a socket using shutdown(2) by
interpreting NULL 'data' argument passed to proto_common_send() or
proto_common_recv() as a will to do so.

MFC after:	1 month
2011-04-02 09:22:06 +00:00
Pawel Jakub Dawidek
2a49afacd1 Handle the problem described in r220264 by using GEOM GATE queue of unlimited
length. This should fix deadlocks reported by HAST users.

MFC after:	1 week
2011-04-02 07:01:09 +00:00
Pawel Jakub Dawidek
ab9092093c Because ggatel(8) operates on local GEOM providers, use unlimited queue size in
GEOM GATE to fix the issue described in r220264. This also means that we no
longer need -q option, remove it. Don't bother to leaving it as a no-op, as
ggatel(8) is just an example utility.
2011-04-02 06:59:05 +00:00
Pawel Jakub Dawidek
54987cacfd Add mapsize to the header just before sending the packet.
Before it could change later and we were sending invalid mapsize.
Some time ago I added optimization where when nodes are connected for the
first time and there were no writes to them yet, there is no initial full
synchronization. This bug prevented it from working.

MFC after:	1 week
2011-03-25 20:19:15 +00:00
Pawel Jakub Dawidek
7d4df5cd0b Use timeout from configuration file not only when sending and receiving,
but also when establishing connection.

MFC after:	1 week
2011-03-25 20:15:16 +00:00
Pawel Jakub Dawidek
643080b75f Use role2str() when setting process title.
MFC after:	1 week
2011-03-25 20:13:38 +00:00
Alexander Motin
89b172238a MFgraid/head:
Add new RAID GEOM class, that is going to replace ataraid(4) in supporting
various BIOS-based software RAIDs. Unlike ataraid(4) this implementation
does not depend on legacy ata(4) subsystem and can be used with any disk
drivers, including new CAM-based ones (ahci(4), siis(4), mvs(4), ata(4)
with `options ATA_CAM`). To make code more readable and extensible, this
implementation follows modular design, including core part and two sets
of modules, implementing support for different metadata formats and RAID
levels.

Support for such popular metadata formats is now implemented:
Intel, JMicron, NVIDIA, Promise (also used by AMD/ATI) and SiliconImage.

Such RAID levels are now supported:
RAID0, RAID1, RAID1E, RAID10, SINGLE, CONCAT.

For any all of these RAID levels and metadata formats this class supports
full cycle of volume operations: reading, writing, creation, deletion,
disk removal and insertion, rebuilding, dirty shutdown detection
and resynchronization, bad sector recovery, faulty disks tracking,
hot-spare disks. For Intel and Promise formats there is support multiple
volumes per disk set.

Look graid(8) manual page for additional details.

Co-authored by:	imp
Sponsored by:	Cisco Systems, Inc. and iXsystems, Inc.
2011-03-24 21:31:32 +00:00
Alexander Motin
83d165c127 MFgraid/head r217014:
Make `geom XXX list` and `geom XXX status` outputs more consistent:
Add -a options to print all geoms, not only ones with providers.
Add -g option for `status` to report geom's names, not provider's.
Make `status` by default report provider's status (if present), not geom's.
Make `status` report consumer's statuses, not only "synchronized" field.
2011-03-24 19:11:05 +00:00
Ruslan Ermilov
34ae1bb65b It's possible to unmount multiple items at once, make it clear. 2011-03-24 12:35:09 +00:00
Gleb Smirnoff
a3d0282dad Fix SYNOPSIS. 2011-03-23 13:44:09 +00:00
Pawel Jakub Dawidek
640b7ee623 Don't create socketpair for connection forwarding between parent and secondary.
Secondary doesn't need to connect anywhere.

MFC after:	1 week
2011-03-23 11:09:04 +00:00
Juli Mallett
9775d5ebdf Add support for displaying newfs flags for SU+J and TRIM. 2011-03-23 08:33:12 +00:00
Pawel Jakub Dawidek
6d51b7d530 Add my copyright.
MFC after:	1 week
2011-03-22 21:19:51 +00:00
Pawel Jakub Dawidek
2237b7ea21 Forgot to commit this as part of r219873.
MFC after:	1 week
2011-03-22 21:11:36 +00:00
Mikolaj Golub
9237aa3fa5 After synchronization is complete we should make primary counters be
equal to secondary counters:

  primary_localcnt = secondary_remotecnt
  primary_remotecnt = secondary_localcnt

Previously it was done wrong and split-brain was observed after
primary had synchronized up-to-date data from secondary.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-03-22 20:27:26 +00:00
Mikolaj Golub
b068d5aafb For requests that are sent only to remote component use the
error from remote.
Approved by:	pjd (mentor)
MFC after:	1 week
2011-03-22 19:49:27 +00:00
Pawel Jakub Dawidek
e2eabb44d7 The proto API is a general purpose API, so don't use 'hast' in structures or
function names. It can now be used outside of HAST.

MFC after:	1 week
2011-03-22 16:21:11 +00:00
Pawel Jakub Dawidek
cd72d521e3 White space cleanups.
MFC after:	1 week
2011-03-22 10:39:34 +00:00
Pawel Jakub Dawidek
4d8dc3b838 When dropping privileges prefer capsicum over chroot+setgid+setuid.
We can use capsicum for secondary worker processes and hastctl.
When working as primary we drop privileges using chroot+setgid+setuid
still as we need to send ioctl(2)s to ggate device, for which capsicum
doesn't allow (yet).

X-MFC after:	capsicum is merged to stable/8
2011-03-21 21:31:50 +00:00
Pawel Jakub Dawidek
9446b4536e Initialize localcnt on first write. This fixes assertion when we create
resource, set role to primary, do no writes, then sent it to secondary
and accept connection from primary.

MFC after:	1 week
2011-03-21 21:16:12 +00:00
Pawel Jakub Dawidek
756cb15420 Fix typo.
MFC after:	1 week
2011-03-21 21:14:07 +00:00
Pawel Jakub Dawidek
351758d85b Before handling any events on descriptors check signals so we can update
our info about worker processes if any of them was terminated in the meantime.

This fixes the problem with 'hastctl status' running from a hook called on
split-brain:
1. Secondary calls a hooks and terminates.
2. Hook asks for resource status via 'hastctl status'.
3. The main hastd handles the status request by sending it to the secondary
   worker who is already dead, but because signals weren't checked yet he
   doesn't know that and we get EPIPE.

MFC after:	1 week
2011-03-21 15:29:20 +00:00
Glen Barber
8e99556f73 Bump date from previous commit. 2011-03-21 15:17:02 +00:00
Pawel Jakub Dawidek
ed646d4dbc Remove stale comment. Yes, it is valid to set role back to init.
MFC after:	1 week
2011-03-21 15:08:10 +00:00
Pawel Jakub Dawidek
2b5ad0e077 Increase debug level of "Checking hooks." message.
MFC after:	1 week
2011-03-21 14:53:27 +00:00
Pawel Jakub Dawidek
e208a185f0 Be pedantic and free nvout before exiting.
MFC after:	1 week
2011-03-21 14:51:16 +00:00
Pawel Jakub Dawidek
38ea70cadf Detect situation where resource internal identifier differs.
This means that both nodes have separately managed resources that don't
have the same data.

MFC after:	1 week
2011-03-21 14:50:12 +00:00
Pawel Jakub Dawidek
4b6b8dd656 Forgot to commit this as a part of r219818.
MFC after:	1 week
2011-03-21 11:52:00 +00:00
Pawel Jakub Dawidek
0b626a289e In hast.conf we define the other node's address in 'remote' variable.
This way we know how to connect to secondary node when we are primary.
The same variable is used by the secondary node - it only accepts
connections from the address stored in 'remote' variable.
In cluster configurations it is common that each node has its individual
IP address and there is one addtional shared IP address which is assigned
to primary node. It seems it is possible that if the shared IP address is
from the same network as the individual IP address it might be choosen by
the kernel as a source address for connection with the secondary node.
Such connection will be rejected by secondary, as it doesn't come from
primary node individual IP.

Add 'source' variable that allows to specify source IP address we want to
bind to before connecting to the secondary node.

MFC after:	1 week
2011-03-21 08:54:59 +00:00
Pawel Jakub Dawidek
1884f6bbf3 Log when we start hooks checking and when we execute a hook.
MFC after:	1 week
2011-03-21 08:38:24 +00:00
Pawel Jakub Dawidek
8a8763b7cf Use snprlcat() instead of two strlcat(3)s.
MFC after:	1 week
2011-03-21 08:37:50 +00:00
Pawel Jakub Dawidek
9925a680a9 Add snprlcat() and vsnprlcat() - the functions I'm always missing.
They work as a combination of snprintf(3) and strlcat(3) - the caller
can append a string build based on the given format.

MFC after:	1 week
2011-03-21 08:36:50 +00:00
Pawel Jakub Dawidek
4f0ec4797a When creating connection on behalf of primary worker, set pjdlog prefix
to resource name and role, so that any logs related to that can be identified
properly.

MFC after:	1 week
2011-03-21 08:33:58 +00:00
Pawel Jakub Dawidek
c3a8627c9a If there is any traffic on one of out descriptors, we were not checking for
long running hooks. Fix it by not using select(2) timeout to decide if we want
to check hooks or not.

MFC after:	1 week
2011-03-21 08:31:35 +00:00
Glen Barber
a34287fbad Use 'list scan' in favor of 'scan', as 'scan' has a different purpose.
Pointed out by:	bschmidt
MFC after:	1 day
2011-03-20 22:47:41 +00:00
Hajimu UMEMOTO
9201145d02 Use resolvconf(8) to update /etc/resolv.conf.
If you don't want to use resolvconf(8) to update /etc/resolv.conf,
you can put resolvconf_enable="NO" into /etc/dhclient-enter-hooks.
2011-03-18 12:23:20 +00:00
Hajimu UMEMOTO
b7f8411df2 Add resolvconf(8) which manages resolv.conf. 2011-03-18 12:18:52 +00:00
Mikolaj Golub
8d7dcf14ff For secondary, set 2 * HAST_KEEPALIVE seconds timeout for incoming
connection so the worker will exit if it does not receive packets from
the primary during this interval.

Reported by:	Christian Vogt <Christian.Vogt@haw-hamburg.de>
Tested by:	Christian Vogt <Christian.Vogt@haw-hamburg.de>
Approved by:	pjd (mentor)
MFC after:	1 week
2011-03-17 21:02:14 +00:00