From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VVucf-0002dP-Pi for mharc-grub-devel@gnu.org; Mon, 14 Oct 2013 22:44:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVucZ-0002dF-GE for grub-devel@gnu.org; Mon, 14 Oct 2013 22:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVucQ-0004Dq-J6 for grub-devel@gnu.org; Mon, 14 Oct 2013 22:44:31 -0400 Received: from mail-lb0-x22e.google.com ([2a00:1450:4010:c04::22e]:60604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVucQ-0004De-BG for grub-devel@gnu.org; Mon, 14 Oct 2013 22:44:22 -0400 Received: by mail-lb0-f174.google.com with SMTP id w6so6296771lbh.33 for ; Mon, 14 Oct 2013 19:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=IZkZdZhfq3+QK9kXjbY3RGbF2gcT7n+U+k7LkPrOkmg=; b=fTOZdRNi8sDWQSJSj4BWeLxBgUbG/6n3z+Puwnqiq4YqQowmsZYrbH4a3zhC4KO3Iz huNpUEq77/32ojLXdx/jRLbi06lNyAmWsFoHSlChi6Crt4SzgU/mcam9M4Pkuu5ZMTPF H/OzCFugVDS7NB5eR8aKePzGP7QbSZHELWxXyemOgmbWg9hkIbqHx/nU4VTKGOlvPil0 aPy91GYFcnCqw+yO6HSLPS2TgH/2AQZC2GcN0K2rhhvsP9iBi+1QlyJpU5ExwXmQIPed GekC71N2EHCyNy22Ut3ISssTshsanxCFum4vHOHm4ftd5/Di7+6E7XIachS0cQ/B+Ux7 4E2w== X-Received: by 10.112.143.3 with SMTP id sa3mr32941162lbb.12.1381805060978; Mon, 14 Oct 2013 19:44:20 -0700 (PDT) Received: from opensuse.site (ppp91-76-150-246.pppoe.mtu-net.ru. [91.76.150.246]) by mx.google.com with ESMTPSA id vo1sm45796671lbb.1.1969.12.31.16.00.00 (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 14 Oct 2013 19:44:20 -0700 (PDT) Date: Tue, 15 Oct 2013 06:44:19 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: booting btrfs Message-ID: <20131015064419.60a41579@opensuse.site> In-Reply-To: <525C5BB9.9030607@gmail.com> References: <0C284942-C2D0-4520-93B1-3982E6AA38DF@colorremedies.com> <525AF8CD.7050100@gmail.com> <525B2D55.8060502@gmail.com> <339EF7EB-F50A-47F6-99BA-F46ABFECCF74@colorremedies.com> <20131014092807.6917958c@opensuse.site> <3D77CF50-285F-42C2-9325-47AC5ACF5FDC@colorremedies.com> <525C4615.5080803@gmail.com> <04468BB2-5F2D-47BA-8CFC-7C5604FBE315@colorremedies.com> <525C5BB9.9030607@gmail.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/gNhfYbMc9WLAToXpzv7l_Od"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22e X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2013 02:44:36 -0000 --Sig_/gNhfYbMc9WLAToXpzv7l_Od Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Mon, 14 Oct 2013 23:01:45 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 14.10.2013 22:45, Chris Murphy wrote: > >=20 > > On Oct 14, 2013, at 1:29 PM, Vladimir '=CF=86-coder/phcoder' Serbinenko= wrote: > >=20 > >>> So it seems that GRUB is using relative pathnames to the default subv= olume. > >> This is not intentional. When this part of code was written there was = no > >> set-default available at all so this couldn't be tested and I simply > >> followed the specification. It told to take root_tree and > >> root_dir_objectid from superblock then go to "default" directory. What > >> of this needs to be changed? Just remove "default" and make it part of > >> path? We would need to change grub-mkrelpath to match runtime behaviou= r. > >> Is there a way to detect that mountinfo gives garbage and somehow get > >> where the real root points? > >=20 > > Here's the response. It seems similar but not identical to what you des= cribed above. > >=20 > > http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg27955.html > >=20 > Possibly this is the answer: > =3D=3D=3D modified file 'grub-core/fs/btrfs.c' > --- grub-core/fs/btrfs.c 2013-01-21 01:33:46 +0000 > +++ grub-core/fs/btrfs.c 2013-10-14 21:00:53 +0000 > @@ -1217,7 +1217,7 @@ >=20 > *type =3D GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; > *tree =3D data->sblock.root_tree; > - key->object_id =3D data->sblock.root_dir_objectid; > + key->object_id =3D grub_cpu_to_le64_compile_time (5); > key->type =3D GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; > key->offset =3D 0; > skip_default =3D 1; >=20 >=20 >=20 Nope, the actual problem here is that find_path starts with looking up "default". Which arguably it should not do, but simply interpret path name as starting from top level. If btrfs filesystem has subvolumes /sub1 and /sub2, even we have set default to /sub2, it is still possible to mount /sub1 using explicit "mount -o subvol=3D/sub1 ...". Given current grub implementation any access outside of default subvolume is impossible. But this also means that grub user level tools have to resolve all path names to be absolute. It is possible - "btrfs subvolume list" gives you subvolume paths, so this information is available. And, BTW, subvolume can be inside of normal directory as well. I.e. mkdir /dir btrfs subvolume create /dir/sub is legal. And you can still mount /dir/sub using option -o subvol=3D/dir/sub. --Sig_/gNhfYbMc9WLAToXpzv7l_Od Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlJcrAMACgkQR6LMutpd94yhwACfY/Rg4KPWReq0r2W7kky0SmaW kmEAni0UXOrkv/B7BSdNMUjVyuE7OLby =Pzlr -----END PGP SIGNATURE----- --Sig_/gNhfYbMc9WLAToXpzv7l_Od--