From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeouQ-0000kV-Eb for qemu-devel@nongnu.org; Fri, 08 Nov 2013 11:27:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeouI-0007pA-W5 for qemu-devel@nongnu.org; Fri, 08 Nov 2013 11:27:46 -0500 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:56704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeouI-0007oy-PY for qemu-devel@nongnu.org; Fri, 08 Nov 2013 11:27:38 -0500 Message-ID: <527D10F2.5050606@weilnetz.de> Date: Fri, 08 Nov 2013 17:27:30 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1383707361-19580-1-git-send-email-gesaint@linux.vnet.ibm.com> <1383707361-19580-3-git-send-email-gesaint@linux.vnet.ibm.com> <20131108161935.GC19612@localhost.localdomain> In-Reply-To: <20131108161935.GC19612@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V6 2/5] qemu-img: Add infinite loop checking in bdrv_new_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xu Wang Cc: kwolf@redhat.com, famz@redhat.com, stefanha@gmail.com, Jeff Cody , qemu-devel@nongnu.org, wdongxu@linux.vnet.ibm.com, Xu Wang , xiawenc@linux.vnet.ibm.com See more suggestions below. Am 08.11.2013 17:19, schrieb Jeff Cody: > On Tue, Nov 05, 2013 at 10:09:18PM -0500, Xu Wang wrote: >> Every image should be checked if there is infinite loop in backing >> file chain before open it. So infinite loop check was added into. ... if there is an infinite loop in the backing file chain before opening it. ... >> bdrv_new_open(). If @filename is opened without the flag >> BDRV_O_NO_BACKING, the infinite loop check should be called. >> >> Signed-off-by: Xu Wang >> --- >> qemu-img.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/qemu-img.c b/qemu-img.c >> index d5ec45b..3af7996 100644 >> --- a/qemu-img.c >> +++ b/qemu-img.c >> @@ -281,6 +281,14 @@ static BlockDriverState *bdrv_new_open(const char *filename, >> drv = NULL; >> } >> >> + /* check backing file loop if the whole chain need to be opened */ ... if the whole chain needs to be opened ... >> + if (!(flags & BDRV_O_NO_BACKING) && >> + !bdrv_backing_chain_okay(filename, fmt)) { >> + error_report("bdrv_new_open: Open %s failed. There is loop exists " >> + "in the backing chain", filename); > I suggest rewording this for grammar; something like: > + error_report("bdrv_new_open: Open %s failed. An infinite loop exists " > + "in the backing chain", filename); > > >> + goto fail; >> + } >> + >> ret = bdrv_open(bs, filename, NULL, flags, drv, &local_err); >> if (ret < 0) { >> error_report("Could not open '%s': %s", filename, >> -- >> 1.8.1.4