From 48cb9b3c7bb954e17f550c11f26e13184f11e0b6 Mon Sep 17 00:00:00 2001 From: trociny Date: Thu, 31 Oct 2013 20:31:16 +0000 Subject: [PATCH] MFC r257154: Merging local and remote bitmaps must be protected by hr_amp lock. This is believed to fix hastd crashes, which might occur during synchronization, triggered by the failed assertion: Assertion failed: (amp->am_memtab[ext] > 0), function activemap_write_complete, file activemap.c, line 351. git-svn-id: svn://svn.freebsd.org/base/stable/9@257470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/hastd/primary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index 85f1c2817..a099d63c5 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -781,6 +781,7 @@ init_remote(struct hast_resource *res, struct proto_conn **inp, free(map); goto close; } + mtx_lock(&res->hr_amp_lock); /* * Merge local and remote bitmaps. */ @@ -790,7 +791,6 @@ init_remote(struct hast_resource *res, struct proto_conn **inp, * Now that we merged bitmaps from both nodes, flush it to the * disk before we start to synchronize. */ - mtx_lock(&res->hr_amp_lock); (void)hast_activemap_flush(res); } nv_free(nvin); -- 2.45.0