Author: pjd
Date: Thu Dec 16 07:30:47 2010
New Revision: 216479
URL: http://svn.freebsd.org/changeset/base/216479

Log:
  Improve problems logging.
  
  MFC after:    3 days

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c   Thu Dec 16 07:29:58 2010        (r216478)
+++ head/sbin/hastd/primary.c   Thu Dec 16 07:30:47 2010        (r216479)
@@ -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;
                }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to