From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1BpK-0000LZ-8T for qemu-devel@nongnu.org; Mon, 22 Jul 2013 04:50:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1BpH-0001s2-8e for qemu-devel@nongnu.org; Mon, 22 Jul 2013 04:50:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1BpH-0001pv-1K for qemu-devel@nongnu.org; Mon, 22 Jul 2013 04:50:39 -0400 Date: Mon, 22 Jul 2013 16:50:32 +0800 From: Fam Zheng Message-ID: <20130722085032.GC8998@T430s.redhat.com> References: <1374480349-11412-1-git-send-email-cngesaint@gmail.com> <1374480349-11412-5-git-send-email-cngesaint@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374480349-11412-5-git-send-email-cngesaint@gmail.com> Subject: Re: [Qemu-devel] [PATCH V4 4/5] block: Add backing file loop check in change_backing_file() Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xu Wang Cc: kwolf@redhat.com, stefanha@gmail.com, wdongxu@linux.vnet.ibm.com, qemu-devel@nongnu.org On Mon, 07/22 04:05, Xu Wang wrote: > Backing file loop should be checked before calling change_backing_ > file(). If loop appeared, this calling should be stopped and an > error was printed. > > Signed-off-by: Xu Wang > --- > block.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/block.c b/block.c > index 9daf63c..d996524 100644 > --- a/block.c > +++ b/block.c > @@ -1967,6 +1967,13 @@ int bdrv_change_backing_file(BlockDriverState *bs, > return -EINVAL; > } > > + /* Check if loop exists in backing files chain after changed */ > + if (bdrv_backing_file_loop_check(bs->filename, > + bs->drv ? bs->drv->format_name : NULL, > + backing_file, backing_fmt)) { I'm wondering if it will be helpful to add a concrete error message here, e.g. for qemu-img rebase, so it will be easier for user to know it fails because of backing loop. > + return -EIO; > + } > + > if (drv->bdrv_change_backing_file != NULL) { > ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt); > } else { > -- > 1.8.1.4 > -- Fam