From: "Jun Zhu (Intern)" Subject: [PATCH]:libxl__get_free_memory_slack cannot return when creating a vm by xl Date: Sun, 26 Sep 2010 19:30:12 +0100 Message-ID: <433DDF91DFB08148BAD3FDB6FDDA314C9F3703C5FF@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: Content-Language: en-GB 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" Cc: "Jun Zhu (Intern)" List-Id: xen-devel@lists.xenproject.org Hi, This patch fixes the problem when xl create invokes libxl__get_free_memory_= slack which does not return. In the libxl__fill_dom0_memory_info function, = if */memory/target is existed, it returns directly, leaving */memory/freeme= m-slack still empty.=20 I don't think it is necessory to check */memory/target in the function libx= l__fill_dom0_memory_info, since this function is to fill the dom0=92s memor= y info. Moreover, it is not correct to believe that */memory/freemem-slack = exists by checking */memory/target.=20 signed-off-by:Jun Zhu diff -r 0c102f92d61e tools/libxl/libxl.c --- a/tools/libxl/libxl.c Sun Sep 26 18:53:15 2010 +0100 +++ b/tools/libxl/libxl.c Sun Sep 26 19:26:42 2010 +0100 @@ -2779,7 +2779,6 @@ static int libxl__fill_dom0_memory_info( int rc; libxl_dominfo info; libxl_physinfo physinfo; - char *target =3D NULL, *endptr =3D NULL; char *target_path =3D "/local/domain/0/memory/target"; char *max_path =3D "/local/domain/0/memory/static-max"; char *free_mem_slack_path =3D "/local/domain/0/memory/freemem-slack"; @@ -2790,19 +2789,6 @@ static int libxl__fill_dom0_memory_info( retry_transaction: t =3D xs_transaction_start(ctx->xsh); =20 - target =3D libxl__xs_read(gc, t, target_path); - if (target) { - *target_memkb =3D strtoul(target, &endptr, 10); - if (*endptr !=3D '\0') { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, - "invalid memory target %s from %s\n", target, target_p= ath); - rc =3D ERROR_FAIL; - goto out; - } - rc =3D 0; - goto out; - } - rc =3D libxl_domain_info(ctx, &info, 0); if (rc < 0) return rc; @@ -2827,12 +2813,10 @@ retry_transaction: *target_memkb =3D (uint32_t) info.current_memkb; rc =3D 0; =20 -out: if (!xs_transaction_end(ctx->xsh, t, 0)) if (errno =3D=3D EAGAIN) goto retry_transaction; =20 - return rc; } Jun Zhu Citrix Systems UK=