Deleted Added
full compact
secondary.c (219818) secondary.c (219830)
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>
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 219818 2011-03-21 08:54:59Z pjd $");
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 219830 2011-03-21 14:50:12Z 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 <err.h>

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

254 if (nv_exists(nvin, "virgin")) {
255 free(map);
256 map = NULL;
257 mapsize = 0;
258 } else {
259 memset(map, 0xff, mapsize);
260 }
261 nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
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 <err.h>

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

254 if (nv_exists(nvin, "virgin")) {
255 free(map);
256 map = NULL;
257 mapsize = 0;
258 } else {
259 memset(map, 0xff, mapsize);
260 }
261 nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
262 } else if (res->hr_resuid != resuid) {
263 char errmsg[256];
264
265 (void)snprintf(errmsg, sizeof(errmsg),
266 "Resource unique ID mismatch (primary=%ju, secondary=%ju).",
267 (uintmax_t)resuid, (uintmax_t)res->hr_resuid);
268 pjdlog_error("%s", errmsg);
269 nv_add_string(nvout, errmsg, "errmsg");
270 if (hast_proto_send(res, res->hr_remotein, nvout, NULL, 0) < 0) {
271 pjdlog_exit(EX_TEMPFAIL, "Unable to send response to %s",
272 res->hr_remoteaddr);
273 }
274 exit(EX_CONFIG);
262 } else if (
263 /* Is primary is out-of-date? */
264 (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
265 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
266 /* Node are more or less in sync? */
267 (res->hr_secondary_localcnt == res->hr_primary_remotecnt &&
268 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
269 /* Is secondary is out-of-date? */

--- 514 unchanged lines hidden ---
275 } else if (
276 /* Is primary is out-of-date? */
277 (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
278 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
279 /* Node are more or less in sync? */
280 (res->hr_secondary_localcnt == res->hr_primary_remotecnt &&
281 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
282 /* Is secondary is out-of-date? */

--- 514 unchanged lines hidden ---