From: John Levon Subject: race with restart and device removal Date: Wed, 4 Apr 2007 23:13:30 +0100 Message-ID: <20070404221330.GA27632@totally.trollied.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline 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 We've observed that sometimes during restart some of a domain's vbds failed to be created. From some debugging it appears to be this code: # Marshall devices (running or from configuration) if not ignore_devices: for cls in XendDevices.valid_devices(): found = False # figure if there is a device that is running if domain: try: controller = domain.getDeviceController(cls) configs = controller.configurations() for config in configs: sxpr.append(['device', config]) found = True except: log.exception("dumping sxp from device controllers") pass # if we didn't find that device, check the existing config # for a device in the same class if not found: for dev_type, dev_info in self.all_devices_sxpr(): if dev_type == cls: sxpr.append(['device', dev_info]) 'configs' comes from the xen store: def deviceIDs(self, transaction = None): """@return The IDs of each of the devices currently configured for this instance's deviceClass. """ fe = self.backendRoot() if transaction: return map(lambda x: int(x.split('/')[-1]), transaction.list(fe)) else: return map(int, xstransact.List(fe)) But this can race against the disk backend removing the xenstore entries itself: so we may have removed one device but not the other. I wonder why we're looking at the running devices at all here? What's the best fix? thanks john