Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2013 20:05:08 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259194 - head/sbin/hastd
Message-ID:  <201312102005.rBAK58cV097485@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Tue Dec 10 20:05:07 2013
New Revision: 259194
URL: http://svnweb.freebsd.org/changeset/base/259194

Log:
  In remote_send_thread, if sending a request fails don't take the
  request back from the receive queue -- it might already be processed
  by remote_recv_thread, which lead to crashes like below:
  
    (primary) Unable to receive reply header: Connection reset by peer.
    (primary) Unable to send request (Connection reset by peer):
        WRITE(954662912, 131072).
    (primary) Disconnected from kopusha:7772.
    (primary) Increasing localcnt to 1.
    (primary) Assertion failed: (old > 0), function refcnt_release,
        file refcnt.h, line 62.
  
  Taking the request back was not necessary (it would properly be
  processed by the remote_recv_thread) and only complicated things.
  
  MFC after:	2 weeks

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Tue Dec 10 20:02:09 2013	(r259193)
+++ head/sbin/hastd/primary.c	Tue Dec 10 20:05:07 2013	(r259194)
@@ -1656,18 +1656,9 @@ remote_send_thread(void *arg)
 			    "Unable to send request (%s): ",
 			    strerror(hio->hio_errors[ncomp]));
 			remote_close(res, ncomp);
-			/*
-			 * Take request back from the receive queue and move
-			 * it immediately to the done queue.
-			 */
-			mtx_lock(&hio_recv_list_lock[ncomp]);
-			TAILQ_REMOVE(&hio_recv_list[ncomp], hio,
-			    hio_next[ncomp]);
-			hio_recv_list_size[ncomp]--;
-			mtx_unlock(&hio_recv_list_lock[ncomp]);
-			goto done_queue;
+		} else {
+			rw_unlock(&hio_remote_lock[ncomp]);
 		}
-		rw_unlock(&hio_remote_lock[ncomp]);
 		nv_free(nv);
 		if (wakeup)
 			cv_signal(&hio_recv_list_cond[ncomp]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312102005.rBAK58cV097485>