From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH] Only retry mapping pages when ENOENT is returned Date: Wed, 4 Jan 2012 11:46:54 +0100 Message-ID: <20120104104654.GA5554@aepfle.de> References: <14d42c7d8e0817040186.1324094120@dev.gridcentric.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <14d42c7d8e0817040186.1324094120@dev.gridcentric.ca> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Adin Scannell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, Dec 16, Adin Scannell wrote: > # HG changeset patch > # User Adin Scannell > # Date 1324094033 18000 > # Node ID 14d42c7d8e0817040186cd01c46f034999fc5dff > # Parent 9dcc8557a0cb676b84e6788e03ab596bcfda7143 > Only retry mapping pages when ENOENT is returned > > If the return value from the ioctl() is not ENOENT, it's possible that err[i] > will not be updated and libxc will just loop forever. Although it's unlikely > that err[i] would not be updated after the ioctl() gets through at least once, > it's better to be defensive. In linux-2.6.18-xen.hg the ioctl could in theory return -ENOMEM in a later iteration and maybe even other values if the guest was destroyed meanwhile. So checking also errno for ENOENT is good, because thats the return code if any of the requested gfns is still in paged-out state. Acked-by: Olaf Hering > diff -r 9dcc8557a0cb -r 14d42c7d8e08 tools/libxc/xc_linux_osdep.c > --- a/tools/libxc/xc_linux_osdep.c > +++ b/tools/libxc/xc_linux_osdep.c > @@ -232,7 +232,7 @@ static void *linux_privcmd_map_foreign_b > do { > usleep(100); > rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx); > - } while ( rc < 0 && err[i] == -ENOENT ); > + } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT ); > } > } > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >