From 04dabf8bdf7cca82fc67ce5cda74a1574de76609 Mon Sep 17 00:00:00 2001 From: pjd Date: Thu, 16 Dec 2010 07:30:47 +0000 Subject: [PATCH] Improve problems logging. MFC after: 3 days --- sbin/hastd/primary.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index 879124f3dbf9..cf597368401a 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -1135,6 +1135,16 @@ local_send_thread(void *arg) /* * If READ failed, try to read from remote node. */ + if (ret < 0) { + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%s), trying remote node. ", + strerror(errno)); + } else if (ret != ggio->gctl_length) { + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%zd != %jd), trying remote node. ", + (intmax_t)ret, + (intmax_t)ggio->gctl_length); + } QUEUE_INSERT1(hio, send, rncomp); continue; } @@ -1143,28 +1153,43 @@ local_send_thread(void *arg) ret = pwrite(res->hr_localfd, ggio->gctl_data, ggio->gctl_length, ggio->gctl_offset + res->hr_localoff); - if (ret < 0) + if (ret < 0) { hio->hio_errors[ncomp] = errno; - else if (ret != ggio->gctl_length) + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%s): ", + strerror(errno)); + } else if (ret != ggio->gctl_length) { hio->hio_errors[ncomp] = EIO; - else + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%zd != %jd): ", + (intmax_t)ret, (intmax_t)ggio->gctl_length); + } else { hio->hio_errors[ncomp] = 0; + } break; case BIO_DELETE: ret = g_delete(res->hr_localfd, ggio->gctl_offset + res->hr_localoff, ggio->gctl_length); - if (ret < 0) + if (ret < 0) { hio->hio_errors[ncomp] = errno; - else + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%s): ", + strerror(errno)); + } else { hio->hio_errors[ncomp] = 0; + } break; case BIO_FLUSH: ret = g_flush(res->hr_localfd); - if (ret < 0) + if (ret < 0) { hio->hio_errors[ncomp] = errno; - else + reqlog(LOG_WARNING, 0, ggio, + "Local request failed (%s): ", + strerror(errno)); + } else { hio->hio_errors[ncomp] = 0; + } break; } if (refcount_release(&hio->hio_countdown)) { @@ -1446,6 +1471,8 @@ remote_recv_thread(void *arg) if (error != 0) { /* Request failed on remote side. */ hio->hio_errors[ncomp] = error; + reqlog(LOG_WARNING, 0, &hio->hio_ggio, + "Remote request failed (%s): ", strerror(error)); nv_free(nv); goto done_queue; }