Project

General

Profile

Bug #3202

Cannot boot from HAMMER2

Added by mneumann 18 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Kernel
Target version:
Start date:
08/30/2019
Due date:
% Done:

0%

Estimated time:

Description

Booting from HAMMER2 "BOOT" PFS works when created via "newfs_hammer2 -L BOOT".

But when I use "hammer2 pfs-create BOOT", I got the message "hammer2: 'BOOT' PFS not found".
I might have created and deleted the "BOOT" PFS multiple times on that file system.

My BOOT PFS inode number is "0xd9b36ce135528001", but HAMMER2_BOOT_KEY is defined as "0xd9b36ce135528000".
With the following patch I can successfully boot from HAMMER2:

--- a/lib/libstand/hammer2.c
+++ b/lib/libstand/hammer2.c
@@ -692,7 +692,7 @@ h2init(struct hammer2_fs *hfs)
return(-1);
h2lookup(hfs, NULL, 0, 0, NULL, NULL);
r = h2lookup(hfs, &hfs->sroot,
- HAMMER2_BOOT_KEY, HAMMER2_BOOT_KEY,
+ HAMMER2_BOOT_KEY, HAMMER2_BOOT_KEY | 0xFFFFU,
&hfs->sroot, &data);
if (r <= 0) {
printf("hammer2: 'BOOT' PFS not found\n");

I am not sure if this is 100% the right approach.
I would rather like to check for the name explicitly as there can be hash collisions.

To successfully boot from HAMMER2, I have to "set currdev="disk0s1d" and then
"cd /kernel" and then follow normal boot procedure (loadall, boot).

To really be useful, one would have to allow other PFSes than "BOOT" to be booted from,
so that you can boot from a snapshot for instance.

Also available in: Atom PDF