From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsaex-0004uZ-4p for qemu-devel@nongnu.org; Mon, 16 Dec 2013 11:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vsaes-0004NE-Eq for qemu-devel@nongnu.org; Mon, 16 Dec 2013 11:04:43 -0500 Received: from mail-ea0-x22a.google.com ([2a00:1450:4013:c01::22a]:47901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsaes-0004N3-82 for qemu-devel@nongnu.org; Mon, 16 Dec 2013 11:04:38 -0500 Received: by mail-ea0-f170.google.com with SMTP id k10so2351630eaj.29 for ; Mon, 16 Dec 2013 08:04:37 -0800 (PST) Date: Mon, 16 Dec 2013 17:04:28 +0100 From: Stefan Hajnoczi Message-ID: <20131216160428.GC16756@stefanha-thinkpad.redhat.com> References: <1386955768-31830-1-git-send-email-namei.unix@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386955768-31830-1-git-send-email-namei.unix@gmail.com> Subject: Re: [Qemu-devel] [PATCH] sheepdog: fix dynamic grow for running qcow2 format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Kevin Wolf , sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, Stefan Hajnoczi On Sat, Dec 14, 2013 at 01:29:28AM +0800, Liu Yuan wrote: > When running qcow2 over sheepdog, we might meet following problem > > qemu-system-x86_64: shrinking is not supported > > And cause IO errors to Guest. This is because we abuse bs->total_sectors, which > is manipulated by generic block layer and race with sheepdog code. > > We should directly check if offset > vdi_size to dynamically enlarge the volume > instead of 'offset > bs->total_sectors', which will cause problem when following > case happens: > > vdi_size > offset > bs->total_sectors > > # then trigger sd_truncate() to shrink the volume wrongly. > > Cc: qemu-devel@nongnu.org > Cc: Kevin Wolf > Cc: Stefan Hajnoczi > Reported-by: Hadrien KOHL > Signed-off-by: Liu Yuan > --- > block/sheepdog.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) block.c already updates bs->total_sectors if bs->growable so this patch is safe. Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan