From: Ian Jackson Subject: RE: [PATCH] Clear device-model information when destroying an HVM domain with stubdom Date: Thu, 9 Sep 2010 18:15:02 +0100 Message-ID: <19593.5654.393821.928030@mariner.uk.xensource.com> References: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB58@LONPMAILBOX01.citrite.net> <19591.38102.637494.941183@mariner.uk.xensource.com> <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB61@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB61@LONPMAILBOX01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Jun Zhu (Intern)" Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Jun Zhu (Intern) writes ("RE: [Xen-devel] [PATCH] Clear device-model information when destroying an HVM domain with stubdom"): > I make a new path from the newest unstable version. Thanks. Like your previous patch, this seems to have some whitespace and formatting errors. Also, please try to keep your lines to 75 characters or less. > ret = libxl_domain_destroy(ctx, stubdomid, 0); > - goto out; > + if (!ret) > + { > + XL_LOG(ctx, XL_LOG_ERROR, "Destroy stubdom failed, domid=%d\n", stubdomid); Surely libxl_domain_destroy will have already logged errors so there is no need to do so again ? Also I think you have the sense of the error test reversed: ret==0 is success so just if (ret) goto out; will do. > + ret = 0; > + } else if (ret == 0) { ... > + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to kill Device Model [%d]", > + atoi(pid)); > + } > + } > + if (!ret) > + xs_rm(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", domid)); > out: Your logic here seems inconsistent. In the one case you skip the removal by the use of "goto out" and in the other you test "ret". Normally I think the "goto out" approach is probably better here. Ian.