From owner-freebsd-stable@FreeBSD.ORG Wed Oct 13 11:27:05 2010 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73B60106566C for ; Wed, 13 Oct 2010 11:27:05 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id DA01B8FC18 for ; Wed, 13 Oct 2010 11:27:04 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 27D2345C99; Wed, 13 Oct 2010 13:27:03 +0200 (CEST) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id B61F145EE5; Wed, 13 Oct 2010 13:26:56 +0200 (CEST) Date: Wed, 13 Oct 2010 13:26:30 +0200 From: Pawel Jakub Dawidek To: Stefan Bethke Message-ID: <20101013112630.GA1727@garage.freebsd.pl> References: <20101012185100.5AA661CC3E@ptavv.es.net> <4CB53BF7.1020408@yandex.ru> <20101013063311.GA51239@icarus.home.lan> <20101013082036.GK2197@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uAKRQypu60I7Lcqm" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: stable@freebsd.org, "Andrey V. Elsukov" , Jeremy Chadwick Subject: Re: Label question...why does ufs label vanish on mount? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 11:27:05 -0000 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 13, 2010 at 11:47:41AM +0200, Stefan Bethke wrote: > Am 13.10.2010 um 10:20 schrieb Pawel Jakub Dawidek: >=20 > > On Tue, Oct 12, 2010 at 11:33:11PM -0700, Jeremy Chadwick wrote: > >> On Wed, Oct 13, 2010 at 08:29:06AM +0200, Stefan Bethke wrote: > >>> That explains the mechanism, but not the rationale. Or is it just an= unintended consequence? And how is da2p1 different from ufs/mylabel? (Mo= unt da2p1 and ufs/mylabel is removed, but not the other way around.) > >>=20 > >> Pulling in pjd@ who can probably shed some light on this. > >=20 > > The ufs/mylabel provider is based on da2p1, that's why opening da2p1 > > makes ufs/mylabel to be removed and not the other way around. > >=20 > > The ufs/mylabel provider was created, because when da2p1 provider was > > created and LABEL class tasted it, it discovered that this provider > > contains UFS file system with 'mylabel' volume label, so the LABEL class > > created ufs/mylabel provider. Now when you open da2p1 for writing, the > > LABEL class destroys ufs/mylabel, because you may decide to change > > metadata on da2p1, for example you may choose to destroy UFS in there or > > change the volume label. When write open count on da2p1 goes down to > > zero, the LABEL class will be given da2p1 provider for tasting once > > again, so it can rediscover (possibly modified) volume label. > >=20 > > The class may choose to ignore the spoil event from GEOM (it is send on > > first open for write), but if it isn't based on autodiscovering > > metadata. For example the NOP class ignores this event, because it > > doesn't care about metadata of provider it is based on. > >=20 > > If we choose to ignore the spoil event in the LABEL class we will end up > > with stale info, eg. open da2p1 for writing, change its volume label and > > mount it and you will still have old label in /dev/ufs/. >=20 > Thanks a lot (and also to Andrey), that really makes it clear to me! >=20 > I just wish there was an easy way to keep the labels around even while so= meone has the provider open for writing, but I now understand that this req= uires some significant changes. The changes aren't significant. We could eventually ignore spoil event and keep labels around even when underlying provider is opened for writing risking the label is stale. We could then only update or remove the label on retaste event (when underlying provider's open write count goes down to zero). Currently when we do, eg. # dd if=3D/dev/zero of=3D/dev/da2p1 bs=3D1m This is happening: # dd(1) opens da2p1 for writing # GEOM sends spoil event to all consumers of da2p1 # LABEL class destroys /dev/ufs/mylabel provider # dd(1) finishes and closes da2p1 # GEOM sends taste event to all GEOM classes # LABEL class finds no metadata and ignores da2p1 With the new world order this would look like this: # dd(1) opens da2p1 for writing # GEOM sends spoil event to all consumers of da2p1 # LABEL class ignores spoil event # dd(1) finishes and closes da2p1 # GEOM sends taste event to all GEOM classes # LABEL class finds no metadata on da2p1 and destroys /dev/ufs/mylabel --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAky1l2YACgkQForvXbEpPzRgngCg6EgutPHkg7i3WYUe+6IpUf3V kF8AoMriVzdeaTp1Llm6AmpXxPHiewy5 =qD8P -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm--