From: Ian Jackson Subject: Re: [PATCH for-4.6 1/2] libxl: fix devd removal path Date: Tue, 22 Sep 2015 17:35:46 +0100 Message-ID: <22017.33634.843350.555517@mariner.uk.xensource.com> References: <1442938993-94328-1-git-send-email-roger.pau@citrix.com> <1442938993-94328-2-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZeQXn-0007ho-Lv for xen-devel@lists.xenproject.org; Tue, 22 Sep 2015 16:35:51 +0000 In-Reply-To: <1442938993-94328-2-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: Alex Velazquez , xen-devel@lists.xenproject.org, Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org Roger Pau Monne writes ("[PATCH for-4.6 1/2] libxl: fix devd removal path"): > The current flow of the devd helper (in charge of launching hotplug scripts > inside of driver domains) is to wait for the device backend to switch to > state 6 (XenbusStateClosed) and then remove it. This is not correct, since > a domain can reconnect it's PV devices as many times as it wants. Oops. Thanks for investigating. > + p = strstr(path, "/state"); > + if (p != NULL) { > + *p = '\0'; > + } else { > + p = strstr(path, "/online"); > + if (p == NULL) > + goto skip; > + *p = '\0'; > + } I don't think this is correct. You could use strrstr, I guess. But it would probably be better to strrchr '/' and then strcmp the result with /online and/or /state ? > + rc = libxl__xs_write_checked(gc, t, online_path, "0"); > + if (rc) { > + LOG(ERROR, "unable to write to xenstore path %s", online_path); > + goto out; libxl__xs_write_checked logs on error so this is redundant (I appreciate that it was there before...) Ian.