Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2012 10:27:54 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Mikolaj Golub <trociny@freebsd.org>
Cc:        Artem Kajalainen <artem@kayalaynen.ru>, freebsd-stable@freebsd.org
Subject:   Re: problems with hast
Message-ID:  <20120205092753.GA30033@garage.freebsd.pl>
In-Reply-To: <86ipjvbglk.fsf@kopusha.home.net>
References:  <CAGS-ug=KPuuDHTYYcVFrk4D3Q=PhJtEfb4%2B1NknU-Qfu9pJZNw@mail.gmail.com> <86ipjvbglk.fsf@kopusha.home.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jan 29, 2012 at 12:35:35AM +0200, Mikolaj Golub wrote:
> Investigating, it looks after r226859, when 'async' mode was added, we ha=
ve 2
> issues with synchronization from secondary to master (rather very rear ca=
se
> normally):
>=20
> 1) When the synchronization from secondary to master is running and prima=
ry
> gets READ request, the request should be sent to the secondary but actual=
ly it
> is lost. As a result READ operation gets stuck. After the syncronization =
is
> complete the following READ requests, which now can be served by primary,=
 work
> ok.
>=20
> 2) In async mode, for syncronization requests, write_complete() function,
> which sends G_GATE_CMD_DONE command to ggate, is called twice and the sec=
ond
> call fails.
>=20
> Artem, did you run async mode? If you did then I suppose you observed the
> second issue. Could you please try the attached patch?

The analysis and fixes look good to me, please go ahead and commit
(small nits below).

> Index: sbin/hastd/primary.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- sbin/hastd/primary.c	(revision 230661)
> +++ sbin/hastd/primary.c	(working copy)
> @@ -1255,7 +1255,7 @@ ggate_recv_thread(void *arg)
>  		pjdlog_debug(2,
>  		    "ggate_recv: (%p) Moving request to the send queues.", hio);
>  		refcount_init(&hio->hio_countdown, ncomps);
> -		for (ii =3D ncomp; ii < ncomps; ii++)
> +		for (ii =3D ncomp; ncomps !=3D 0; ncomps--, ii++)

I'd prefer not to modify ncomps in the loop, maybe something like this:

		for (ii =3D ncomp; ii < ncomp + ncomps; ii++)

>  			QUEUE_INSERT1(hio, send, ii);
>  	}
>  	/* NOTREACHED */
> @@ -1326,7 +1326,7 @@ local_send_thread(void *arg)
>  			} else {
>  				hio->hio_errors[ncomp] =3D 0;
>  				if (hio->hio_replication =3D=3D
> -				    HAST_REPLICATION_ASYNC) {
> +				    HAST_REPLICATION_ASYNC && !ISSYNCREQ(hio)) {

Could you move this additional check to separate line?

Thanks!

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

--GvXjxJ+pjyke8COw
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk8uS5gACgkQForvXbEpPzRQPwCfXj+FSNO47V13eoRL1DJwuHWK
zlcAoNBPW26Lz+CvQcs48kYXlFFVBarV
=07jR
-----END PGP SIGNATURE-----

--GvXjxJ+pjyke8COw--



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