From d9f039e0b34b48097ecd277f0a90226ab9485360 Mon Sep 17 00:00:00 2001 From: Mikolaj Golub Date: Tue, 28 Jun 2011 21:01:32 +0000 Subject: [PATCH] Check the returned value of activemap_write_complete() and update matadata on disk if needed. This should fix a potential case when extents are cleared in activemap but metadata is not updated on disk. Suggested by: pjd Approved by: pjd (mentor) --- sbin/hastd/primary.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index af0f35375669..e1f2ba4d819b 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -1687,8 +1687,11 @@ ggate_send_thread(void *arg) } if (ggio->gctl_error == 0 && ggio->gctl_cmd == BIO_WRITE) { mtx_lock(&res->hr_amp_lock); - activemap_write_complete(res->hr_amp, - ggio->gctl_offset, ggio->gctl_length); + if (activemap_write_complete(res->hr_amp, + ggio->gctl_offset, ggio->gctl_length)) { + res->hr_stat_activemap_update++; + (void)hast_activemap_flush(res); + } mtx_unlock(&res->hr_amp_lock); } if (ggio->gctl_cmd == BIO_WRITE) {