Improve problems logging.

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2010-12-16 07:30:47 +00:00
parent 7208920499
commit cd7b7ee577
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216479

View File

@ -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;
}