WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xenbus_dev_request_and_reply()

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] xenbus_dev_request_and_reply()
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: Fri, 2 Mar 2007 18:11:38 +0000
Delivery-date: Fri, 02 Mar 2007 10:08:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
I just came across this little charmer:

169 void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
170 {
171         void *ret;
172         struct xsd_sockmsg req_msg = *msg;
173         int err;
174
175         if (req_msg.type == XS_TRANSACTION_START)
176                 down_read(&xs_state.suspend_mutex);
177
178         mutex_lock(&xs_state.request_mutex);
179
180         err = xb_write(msg, sizeof(*msg) + msg->len);
181         if (err) {
182                 msg->type = XS_ERROR;
183                 ret = ERR_PTR(err);
184         } else
185                 ret = read_reply(&msg->type, &msg->len);
186
187         mutex_unlock(&xs_state.request_mutex);
188
189         if ((req_msg.type == XS_TRANSACTION_END) ||
190             ((req_msg.type == XS_TRANSACTION_START) &&
191              (msg->type == XS_ERROR)))
192                 up_read(&xs_state.suspend_mutex);
193
194         return ret;
195 }

So if userspace gets killed during a transaction, we'll never be able to
suspend. And of course an invalid transaction end will panic the domain.

Unfortunately blktap is actually using transactions.

Given that transaction ID's are local to a connection, can't we avoid
taking the mutex altogether? Any further requests as part of the
transaction will not be found in the list and we'll return an error
reply as expected. Am I missing something?

regards
john

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>