From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOppH-0003a4-Ty for qemu-devel@nongnu.org; Thu, 18 Oct 2012 09:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOppG-0000Bt-Sm for qemu-devel@nongnu.org; Thu, 18 Oct 2012 09:07:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOppG-0000Bn-KJ for qemu-devel@nongnu.org; Thu, 18 Oct 2012 09:07:50 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9ID7nPu017928 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Oct 2012 09:07:50 -0400 Message-ID: <507FFF21.2090007@redhat.com> Date: Thu, 18 Oct 2012 15:07:45 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1348675011-8794-1-git-send-email-pbonzini@redhat.com> <1348675011-8794-32-git-send-email-pbonzini@redhat.com> In-Reply-To: <1348675011-8794-32-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 31/45] mirror: add support for on-source-error/on-target-error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: jcody@redhat.com, qemu-devel@nongnu.org Am 26.09.2012 17:56, schrieb Paolo Bonzini: > Error management is important for mirroring; otherwise, an error on the > target (even something as "innocent" as ENOSPC) requires to start again > with a full copy. Similar to on_read_error/on_write_error, two separate > knobs are provided for on_source_error (reads) and on_target_error (writes). > The default is 'report' for both. > > The 'ignore' policy will leave the sector dirty, so that it will be > retried later. Thus, it will not cause corruption. > > Signed-off-by: Paolo Bonzini > --- > v1->v2: error handling for bdrv_flush, introduce mirror_error_action > > block/mirror.c | 95 +++++++++++++++++++++++++++++++++++++++++++------------- > block_int.h | 4 +++ > blockdev.c | 14 +++++++-- > hmp.c | 3 +- > qapi-schema.json | 11 ++++++- > qmp-commands.hx | 8 ++++- > 6 file modificati, 109 inserzioni(+), 26 rimozioni(-) > > diff --git a/block/mirror.c b/block/mirror.c > index 939834d..caec272 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -32,13 +32,28 @@ typedef struct MirrorBlockJob { > RateLimit limit; > BlockDriverState *target; > MirrorSyncMode mode; > + BlockdevOnError on_source_error, on_target_error; > bool synced; > bool complete; > int64_t sector_num; > uint8_t *buf; > } MirrorBlockJob; > > -static int coroutine_fn mirror_iteration(MirrorBlockJob *s) > +static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, > + int error) > +{ > + s->synced = false; > + if (read) { > + return block_job_error_action(&s->common, s->common.bs, > + s->on_source_error, true, error); > + } else { > + return block_job_error_action(&s->common, s->target, > + s->on_target_error, false, error); Here we produce an event that reports an error on s->bs, i.e. on the source, even though the error was on the target. This makes some sense today that the target doesn't have a name, but once it has, we would better use the target name here. Can we change this later on? If not, what's the way forward? Kevin