В Mon, 14 Oct 2013 23:01:45 +0200 Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com> пишет:
> On 14.10.2013 22:45, Chris Murphy wrote: > > > > On Oct 14, 2013, at 1:29 PM, Vladimir 'φ-coder/phcoder' Serbinenko > > <phco...@gmail.com> wrote: > > > >>> So it seems that GRUB is using relative pathnames to the default > >>> subvolume. > >> 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 behaviour. > >> Is there a way to detect that mountinfo gives garbage and somehow get > >> where the real root points? > > > > Here's the response. It seems similar but not identical to what you > > described above. > > > > http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg27955.html > > > Possibly this is the answer: > === 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 @@ > > *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; > *tree = data->sblock.root_tree; > - key->object_id = data->sblock.root_dir_objectid; > + key->object_id = grub_cpu_to_le64_compile_time (5); > key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; > key->offset = 0; > skip_default = 1; > > > 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=/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=/dir/sub.
signature.asc
Description: PGP signature
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel