Deleted Added
sdiff udiff text old ( 214276 ) new ( 214284 )
full compact
1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * This software was developed by Pawel Jakub Dawidek under sponsorship from
7 * the FreeBSD Foundation.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 214276 2010-10-24 15:44:23Z pjd $");
33
34#include <sys/param.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/stat.h>
39
40#include <assert.h>

--- 197 unchanged lines hidden (view full) ---

238 * local=3 remote=3 local=3 remote=4* ?! Full sync from primary.
239 * local=3 remote=3 local=4 remote=2 Split-brain condition.
240 * local=3 remote=3 local=4 remote=3 Secondary out-of-date,
241 * regular sync from primary.
242 * local=3 remote=3 local=4 remote=4* ?! Full sync from primary.
243 */
244 if (res->hr_resuid == 0) {
245 /*
246 * Provider is used for the first time. Initialize everything.
247 */
248 assert(res->hr_secondary_localcnt == 0);
249 res->hr_resuid = resuid;
250 if (metadata_write(res) < 0)
251 exit(EX_NOINPUT);
252 memset(map, 0xff, mapsize);
253 nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
254 } else if (
255 /* Is primary is out-of-date? */
256 (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
257 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
258 /* Node are more or less in sync? */
259 (res->hr_secondary_localcnt == res->hr_primary_remotecnt &&
260 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||

--- 490 unchanged lines hidden ---