Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2018 10:17:03 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334141 - head/sys/dev/xen/xenstore
Message-ID:  <201805241017.w4OAH3Dt076627@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Thu May 24 10:17:03 2018
New Revision: 334141
URL: https://svnweb.freebsd.org/changeset/base/334141

Log:
  xenstore: don't wait with the PCATCH flag
  
  Due to the current synchronous xenstore implementation in FreeBSD, we
  cannot return from xs_read_reply without reading a reply, or else the
  ring gets out of sync and the next request will read the previous
  reply and crash due to the type mismatch. A proper solution involves
  making use of the req_id field in the message and allowing multiple
  in-flight messages at the same time on the ring.
  
  Remove the PCATCH flag so that signals don't interrupt the wait.
  
  Tested by:      Nathan Friess <nathan.friess@gmail.com>
  Sponsored by:   Citrix Systems R&D

Modified:
  head/sys/dev/xen/xenstore/xenstore.c

Modified: head/sys/dev/xen/xenstore/xenstore.c
==============================================================================
--- head/sys/dev/xen/xenstore/xenstore.c	Thu May 24 10:16:11 2018	(r334140)
+++ head/sys/dev/xen/xenstore/xenstore.c	Thu May 24 10:17:03 2018	(r334141)
@@ -742,8 +742,8 @@ xs_read_reply(enum xsd_sockmsg_type *type, u_int *len,
 
 	mtx_lock(&xs.reply_lock);
 	while (TAILQ_EMPTY(&xs.reply_list)) {
-		error = mtx_sleep(&xs.reply_list, &xs.reply_lock,
-		    PCATCH, "xswait", hz/10);
+		error = mtx_sleep(&xs.reply_list, &xs.reply_lock, 0, "xswait",
+		    hz/10);
 		if (error && error != EWOULDBLOCK) {
 			mtx_unlock(&xs.reply_lock);
 			return (error);



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