Commit Graph

355 Commits

Author SHA1 Message Date
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
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
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
Joel Dahl
a53bb70bda Spelling fixes. 2010-07-31 21:09:49 +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
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
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
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
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
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
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
Ulrich Spörlein
7729e3ba40 Remove redundant WARNS?=6 overrides and inherit the WARNS setting from
the toplevel directory.

This does not change any WARNS level and survives a make universe.

Approved by:        ed (co-mentor)
2010-03-02 18:44:08 +00:00
Ruslan Ermilov
c59ee18a21 Fixed static linkage. 2010-02-26 09:41:16 +00:00
Pawel Jakub Dawidek
2e1facf96f Changing proto_socketpair.c compilation and linking order revealed
a problem - we should simply ignore proto_server() if address
doesn't start with socketpair://, and not abort.
2010-02-21 19:56:47 +00:00
Pawel Jakub Dawidek
32115b105a Please welcome HAST - Highly Avalable Storage.
HAST allows to transparently store data on two physically separated machines
connected over the TCP/IP network. HAST works in Primary-Secondary
(Master-Backup, Master-Slave) configuration, which means that only one of the
cluster nodes can be active at any given time. Only Primary node is able to
handle I/O requests to HAST-managed devices. Currently HAST is limited to two
cluster nodes in total.

HAST operates on block level - it provides disk-like devices in /dev/hast/
directory for use by file systems and/or applications. Working on block level
makes it transparent for file systems and applications. There in no difference
between using HAST-provided device and raw disk, partition, etc. All of them
are just regular GEOM providers in FreeBSD.

For more information please consult hastd(8), hastctl(8) and hast.conf(5)
manual pages, as well as http://wiki.FreeBSD.org/HAST.

Sponsored by:	FreeBSD Foundation
Sponsored by:	OMCnet Internet Service GmbH
Sponsored by:	TransIP BV
2010-02-18 23:16:19 +00:00