Received: from eggs.gnu.org ([2001:4830:134:3::10]:44807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buOCM-0005WA-Qn for qemu-devel@nongnu.org; Wed, 12 Oct 2016 14:24:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buOCL-0007Ge-Kp for qemu-devel@nongnu.org; Wed, 12 Oct 2016 14:24:14 -0400 References: <1475232808-4852-1-git-send-email-vsementsov@virtuozzo.com> <1475232808-4852-10-git-send-email-vsementsov@virtuozzo.com> <4a8dc702-62ae-b46f-4fb1-7562392fab33@redhat.com> <57FCE513.3070700@virtuozzo.com> From: Max Reitz Message-ID: <63fd930b-b6b7-d866-a900-ef3ccf1ca7bd@redhat.com> Date: Wed, 12 Oct 2016 20:24:06 +0200 MIME-Version: 1.0 In-Reply-To: <57FCE513.3070700@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XjxnuDngpE134vO2urCR2wj8rEux96hA7" Subject: Re: [Qemu-devel] [PATCH 09/22] block: introduce persistent dirty bitmaps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com, jsnow@redhat.com, famz@redhat.com, den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XjxnuDngpE134vO2urCR2wj8rEux96hA7 From: Max Reitz To: Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com, jsnow@redhat.com, famz@redhat.com, den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com Message-ID: <63fd930b-b6b7-d866-a900-ef3ccf1ca7bd@redhat.com> Subject: Re: [PATCH 09/22] block: introduce persistent dirty bitmaps References: <1475232808-4852-1-git-send-email-vsementsov@virtuozzo.com> <1475232808-4852-10-git-send-email-vsementsov@virtuozzo.com> <4a8dc702-62ae-b46f-4fb1-7562392fab33@redhat.com> <57FCE513.3070700@virtuozzo.com> In-Reply-To: <57FCE513.3070700@virtuozzo.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 11.10.2016 15:11, Vladimir Sementsov-Ogievskiy wrote: > On 07.10.2016 20:54, Max Reitz wrote: >> On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: >>> New field BdrvDirtyBitmap.persistent means, that bitmap should be sav= ed >>> on bdrv_close, using format driver. Format driver should maintain bit= map >>> storing. >>> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy >>> --- >>> block.c | 30 ++++++++++++++++++++++++++++++ >>> block/dirty-bitmap.c | 27 +++++++++++++++++++++++++++ >>> block/qcow2-bitmap.c | 1 + >>> include/block/block.h | 2 ++ >>> include/block/block_int.h | 2 ++ >>> include/block/dirty-bitmap.h | 6 ++++++ >>> 6 files changed, 68 insertions(+) >>> >>> diff --git a/block.c b/block.c >>> index 804e3d4..1cde03a 100644 >>> --- a/block.c >>> +++ b/block.c >>> @@ -2196,6 +2196,7 @@ void bdrv_reopen_abort(BDRVReopenState >>> *reopen_state) >>> static void bdrv_close(BlockDriverState *bs) >>> { >>> BdrvAioNotifier *ban, *ban_next; >>> + Error *local_err =3D NULL; >>> assert(!bs->job); >>> assert(!bs->refcnt); >>> @@ -2204,6 +2205,10 @@ static void bdrv_close(BlockDriverState *bs) >>> bdrv_flush(bs); >>> bdrv_drain(bs); /* in case flush left pending I/O */ >>> + bdrv_store_persistent_bitmaps(bs, &local_err); >>> + if (local_err !=3D NULL) { >>> + error_report_err(local_err); >>> + } >> That seems pretty wrong to me. If the persistent bitmaps cannot be >> stored, the node should not be closed to avoid loss of data. >> >>> bdrv_release_named_dirty_bitmaps(bs); >> Especially since the next function will just drop all the dirty bitmap= s. >> >> I see the issue that bdrv_close() is only called by bdrv_delete() whic= h >> in turn is only called by bdrv_unref(); and how are you supposed to >> react to bdrv_unref() failing? >> >> So I'm not sure how this issue should be addressed, but this is most >> certainly not ideal. You should not just drop supposedly persistent >> dirty bitmaps if they cannot be saved. >> >> We really should to have some way to keep the bitmap around if it cann= ot >> be saved, but I don't know how to do that either. >> >> In any case, we should make sure that the node supports saving >> persistent dirty bitmaps, because having persistent dirty bitmaps at a= >> node that does not support them is something we can and must prevent >> beforehand. >> >> But I don't know how to handle failure if writing the dirty bitmap >> fails. I guess one could argue that it's the same as bdrv_flush() >> failing and thus can be handled in the same way, i.e. ignore it. I'm n= ot >> happy with that, but I'd accept it if there's no other way. >=20 > For now, the only usage of these bitmaps is incremental backup and > bitmaps are not critical data. If we lost them we will just do full > backup. If there will be some critical persistent bdrv dirty bitmaps in= > future, we can introduce a callback BdrvDirtyBitmap.store_failed for > them, which will somehow handle that case.. Detach bitmap from bs and > save it in memory, add qmp commands to raw-dump them, etc.. I Yes, fine with me. Still, we should make an effort to detect the case that some block driver will not be able to store a certain persistent bitmap attached to one of its nodes as early as possible, ideally already when the bitmap is created. Max --XjxnuDngpE134vO2urCR2wj8rEux96hA7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJX/n/GEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQMkK B/sFRiHVjtckLiTde/LqiEtWke/jpKW/FAisVHOspiAZEB7JeJRXSmnRUaMCa4qX WMfYsYlw+V1Fng63PHJgL049p4GpXZ90F7niAgab44DPbz5TVlJmCz5xTUTD7Z8Y pJKtm1oTPwO4Qr9T2xkXxKEIH9n6VkiHmODGrH4E3iwXkFO7YDg5eYbA4St9UEIs 0ojHtYmhoXRXXLEzWIrzeppgjYcALVCuJ9IMU6BYweQVzA8xjpHcxO+pYcsRSAOj 9U7cOuHVAhSXq1ggaNGk/ADH5cbe4nbE7t/4tbxTzJA8oyctsXrAkcMoihkS66Yi cXRRm5Gc/09xzsXwULVd0eOd =/hma -----END PGP SIGNATURE----- --XjxnuDngpE134vO2urCR2wj8rEux96hA7--