From: Kieran Mansley Subject: [PATCH] Fix double-probe of accelerator on suspend_cancel Date: Fri, 08 Feb 2008 14:27:11 +0000 Message-ID: <1202480831.4147.24.camel@moonstone.uk.level5networks.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org I just fixed a bug in the network acceleration stuff where an accelerator could get probed with the same interface twice on a suspend- cancel - once manually in the suspend_cancel handler, and once when the watch on the accel configuration option fired after being reinstated. This patch fixes it. diff -r 0c1a374e9fcb drivers/xen/netfront/accel.c --- a/drivers/xen/netfront/accel.c +++ b/drivers/xen/netfront/accel.c @@ -696,32 +696,11 @@ int netfront_accelerator_suspend_cancel( int netfront_accelerator_suspend_cancel(struct netfront_info *np, struct xenbus_device *dev) { - struct netfront_accel_vif_state *accel_vif_state = NULL; - - mutex_lock(&accelerator_mutex); - - /* Check that we've got a device that was accelerated */ - if (np->accelerator == NULL) - goto out; - - /* Find the vif_state from the accelerator's list */ - list_for_each_entry(accel_vif_state, &np->accelerator->vif_states, - link) { - if (accel_vif_state->dev == dev) { - BUG_ON(accel_vif_state != &np->accel_vif_state); - - /* - * Kick things off again to restore - * acceleration as it was before suspend - */ - accelerator_probe_new_vif(np, dev, np->accelerator); - - break; - } - } - - out: - mutex_unlock(&accelerator_mutex); + /* + * Setting the watch will cause it to fire and probe the + * accelerator, so no need to call accelerator_probe_new_vif() + * directly here + */ netfront_accelerator_add_watch(np); return 0; }